<pre name="code" class="sql">取网页返回header 响应header
[root@dr-mysql01 test]# cat a3.pl
use LWP::Simple;
@content = head("http://www.zjcap.cn/");
die "Couldn't get it!" unless defined @content;
print "@content is @content
";
[root@dr-mysql01 test]# perl a3.pl
@content is text/html 26507 1436245136 nginx/1.7.7
.
[root@dr-mysql01 test]# date -d @1436245136
Tue Jul 7 12:58:56 CST 2015
[root@dr-mysql01 test]#
[root@master test]# cat a9.pl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
$ua = LWP::UserAgent->new(timeout=>180);
$request = HTTP::Request->new;
$request->header('Accept-Language', 'zh-CN,zh;q=0.8');
$response = $ua->request($request);
my $response = $ua->get('http://www.zjcap.cn');
print $response->header('Date');
print $response->header('Server');
[root@master test]# perl a9.pl
Sun, 12 Jul 2015 02:16:05 GMTnginx/1.7.7[root@master test]#