这是我的代码。
use strict;
use warnings;
use WWW::Mechanize;
use HTTP::Cookies;
use FindBin qw($Bin);
use File::Basename qw(dirname);
use lib $Bin.'/../';
my $mech = WWW::Mechanize->new( autocheck => 0 );
$mech->agent_alias( 'Windows Mozilla' );
my $cookie_jar = (HTTP::Cookies->new());
$mech->cookie_jar($cookie_jar);
$mech->cookie_jar( HTTP::Cookies->new() );
my $url = "https://www.google.co.in/" ;
print "Downloading URL=$url\n";
$mech->get($url);
die "Can't even get the home page: ", $mech->response->status_line unless $mech->success;
#&Utilities::getRetryMultipleTimes(\$mech, $url);
my $isZipCodeValid = $mech->content();
print DEBUG "isZipCodeValid=$isZipCodeValid\n";
print $mech->content();
在执行此操作时,我收到上述错误(错误:500无法连接到www.google.co.in:443(连接超时))。但是当我在cmd中运行时,相同的代码完全取出html该网址的内容。有什么可能的情况来获得这种类型的错误服务器错误。任何人都建议解决方案来消除此错误?