Perl 使用 HTTP::Request 请求 URL 并将响应保存到文件的代码:
复制代码 代码如下:
use LWP::UserAgent;
$user_agent = new LWP::UserAgent;
$request = new HTTP::Request('GET', 'http://www.jb200.com/about');
$response = $user_agent->request($request);
open FILEHANDLE, ">jbxue.txt";
print FILEHANDLE $response->{_content};
close FILEHANDLE;