It works like this :
#!/usr/bin/perl -w use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); my @proxies = ( 'http://proxy.no1:8001/', 'http://proxy.no2:8002/', 'http://proxy. +no3:8003//', 'http://proxy.no4:8004/' ); for (@proxies) { $ua->proxy( [ 'http', 'ftp' ] => $_ ); my $req = HTTP::Request->new( 'GET', "http://search.cpan.org/" ); my $res = $ua->request($req); next unless $res->is_success; print $res->decoded_content; last; # Update }
hth,
PooLpi
In reply to Re: multiple proxies with LWP::UserAgent
by poolpi
in thread multiple proxies with LWP::UserAgent
by pingpongd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |