For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > March 2006 > HTTP::ProxySelector









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HTTP::ProxySelector
paddyxmurphy@googlemail.com

2006-03-17, 6:56 pm

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";

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com