我无法通过Perl程序下载以下网站: https://www.federalregister.gov/articles/2014/05/29
我正在尝试将其下载到文件" temp.html"。它返回1 KB的文件大小,filecontent说:
"无法连接到www.federalregister.gov:443连接尝试失败,因为连接方在一段时间后未正确响应,或已建立的连接失败,因为已连接的主机已连接未能回应。在C:/strawberry/perl/site/lib/LWP/Protocol/http.pm第41行。"。
我的代码如下:
use LWP::UserAgent;
use IO::File;
$ua = LWP::UserAgent->new;
$ua->proxy(['https', 'ftp'] => 'http://myusername:mypassword@myofficeproxy:port');
$req = HTTP::Request->new('GET',"https://www.federalregister.gov/articles/2014/05/29");
$res = $ua->request($req);
open(FRSOURCE, ">temp.html");
$temp = $res->decoded_content;
print FRSOURCE $temp;
print $temp if $res->is_success;
close FRSOURCE;
我哪里错了?