1
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5');
$ua->proxy('http' => 'socks://188.26.223.189:1080');
my $response = $ua->get('http://example.com');
print $response->code,' ', $response->message,"\n";
print $response->decoded_content . "\n";
我试着通过袜子代理连接到网站,但我得到的错误:500无法连接到example.com:80 我错了呢?不能老是连接通过SOCKS代理托管在Perl
你有Perl模块,[LWP ::协议::袜子(https://metacpan.org/pod/LWP :: Protocol :: socks)安装? –
是的,我安装了它。 – Artem
看一下[this](http://mlawire.blogspot.com/2009/07/using-lwp-with-tor.html)。除了'[qw/http https /]'外,它看起来差不多。 –