我已经为此沮丧了太多小时了。我认为这应该很简单,但我显然有一些根本的错误。我读过:
我已经阅读了以下cpan文档: WWW-Mechanize/lib/WWW/Mechanize/FAQ.pod libwww-perl-5.837/lib/LWP/UserAgent.pm
以及我能在Google上找到的所有示例代码或文章。
这是我第一次在Stack Overflow上寻求帮助。提前感谢您的帮助。代码如下:
#!/usr/bin/perl
use WWW::Mechanize;
my $mech = WWW::Mechanize->new ( agent => "Mozilla/5.0" );
my $proxy = 'http://fetch4.me';
$mech->no_proxy('localhost');
$mech->proxy(['http', 'https', 'gopher'], $proxy) or die $!;
$mech->get('http://www.google.com');
print $mech->uri(),"\n";
print $mech->content(),"\n";
print $mech->text(),"\n";
print $mech->status(),"\n";下面是输出:
http://www.google.com
<html>Apache is functioning normally</html>
Apache is functioning normally
200我已经没有点子了。这段代码对你有效吗?它会产生相同的结果吗?它有什么问题?>.<
谢谢您抽时间见我。
发布于 2010-12-09 03:47:05
问题似乎出在服务器fetch4.me中。例如,试一试,
my $proxy = 'http://124.207.162.87:80';
发布于 2010-12-07 14:50:53
有没有说:
my $mech = WWW::Mechanize->new ( agent => "Mozilla/5.0", noproxy => 1 );帮助?
该文档暗示您需要这样做,以避免隐式调用LWP的env_proxy。
https://stackoverflow.com/questions/4373993
复制相似问题