Perl 使用 HTTP::Request 请求 URL

use LWP::UserAgent;

$user_agent = new LWP::UserAgent;

$request = new HTTP::Request('GET', 'http://www.oschina.net/home/about');


$response = $user_agent->request($request);

open FILEHANDLE, ">oschina.txt";

print FILEHANDLE $response->content;

close FILEHANDLE;
posted @ 2012-07-25 13:11  deaconx  阅读(536)  评论(0编辑  收藏  举报