HTTP::ProxySelector

P

paddyxmurphy

Hi,

I'm trying to get HTTP::proxySelector working and not having much luck.
The script I'm using to test the module is set out below. When I run
the script it returns the homepage of the proxy selected rather than
the site I'm trying to access. I'd appreciate any suggestions as to
what's going wrong.

Thanks.

Paddy

-----------------------------------------------------------------------------------------------------------------------------------
#!/usr/bin/perl

use strict;
use warnings;
use HTTP::proxySelector;
use LWP::UserAgent;

my $selector = HTTP::proxySelector->new(sites
=>['http://www.multiproxy.org/txt_anon/proxy.txt'],
testflag => 1,
num_tries => 10,
testsite => 'http://yahoo.com');
my $ua = LWP::UserAgent->new();
$selector->set_proxy($ua);
print 'Selected proxy: ',$selector->get_proxy(),"\n";

my $url = "http://yahoo.com";

my $response = $ua->get($url) or die $!;
my $content = $response->content() or die $!;

print "$content\n";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top