Dec 24, 2014, 10:15 AM
Post #2 of 2
Re: [Jmp] perl proxy http lwp::simple & lwp::useragent
[In reply to]
Your code looks ok to me, specifically the $ua->proxy method you tried.
I can't see why you are receiving a "Useless use of addition (+) in void context" warning either, perhaps you ran a different version of your code?
I see that it is being reported that your request is timing out, it is taking too long to process your request and erroring fifteen seconds as per your defined timeout. Is your proxy a dud?
I tested a similar code using a different proxy and url without issue.
use CGI::Carp qw/fatalsToBrowser/; # remove if not in web environment.
print "content-type: text/plain\n\n"; # remove if not in web environment.
my $ua = LWP::UserAgent->new;
$ua->agent( 'Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0.1' );
$ua->timeout( 10 );
$ua->proxy( 'https', 'https://static-209-170-151-14.alwaysdedicated.net' );
my $response = $ua->get( 'http://demo.massweb.co.uk/index.pl' ); # 'http://www.google.com/search?q=perl'
if ( $response->is_success )
(This post was edited by Zhris on Dec 24, 2014, 10:20 AM)