Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: multiple proxies with LWP::UserAgent

by poolpi (Hermit)
on Jul 25, 2008 at 10:59 UTC ( [id://700096]=note: print w/replies, xml ) Need Help??


in reply to multiple proxies with LWP::UserAgent

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

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://700096]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found