perl HTML::HeadParser获取html头部信息

 1 use LWP::Simple;
 2 use HTML::HeadParser;
 3 use utf8;
 4 binmode(STDOUT, ":encoding(gbk)"); #设置win下输出中文
 5 
 6 $result = get('http://www.baidu.com');
 7 $what = HTML::HeadParser->new;
 8 $what->parse($result);
 9 print $what->header('refresh'),"\n";
10 print $what->header('title'),"\n";
11 print $what->header('content_type'),"\n";

 

posted on 2017-03-12 03:10  Perl6  阅读(311)  评论(0编辑  收藏  举报

导航