学习下perl的 HTTP::Request模块的用法。
这里分享一个 HTTP::Request模块的例子。
代码:
#!/bin/perl -w
use LWP::UserAgent;
$user_agent = new LWP::UserAgent;
$request = new HTTP::Request('GET', 'http://www.jb200.com/index.html');
$response = $user_agent->request($request);
open FILEHANDLE, ">file.txt";
print FILEHANDLE $response->{_content};
close FILEHANDLE;