WouterDS has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl use LWP::UserAgent [search.cpan.org]; use HTTP::Request [kobesearch.cpan.org]; my $url = 'http://uploads.wouterds.be/download/63/'; my $agent = LWP::UserAgent->new(env_proxy => 1,keep_alive => 1, timeou +t => 10); my $header = HTTP::Request->new(GET => $url); my $request = HTTP::Request->new('GET', $url, $header); my $response = $agent->request($request); # Check the outcome of the response if($response->is_success){ print "Download ok\n"; } elsif($response->is_error){ print "Error:$url\n"; print $response->error_as_HTML; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Use proxy in perl script
by Corion (Patriarch) on Aug 31, 2011 at 07:58 UTC | |
|
Re: Use proxy in perl script
by CountZero (Bishop) on Aug 31, 2011 at 10:15 UTC | |
|
Re: Use proxy in perl script
by Anonymous Monk on Aug 31, 2011 at 07:55 UTC |