码迷,mamicode.com
首页 > Web开发 > 详细

perl 抓取网页内容

时间:2014-08-01 07:01:51      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:perl抓网页

抓取乐彩网历年排列5数据

 

 use LWP::Simple;
 use FileOperate;
my $src = ‘http://www.17500.cn/p5/all.php‘;
my $FileOperate = FileOperate->new();
my $FilePath = "C:\\Documents and Settings\\Administrator\\桌面\\PrelTest\\保存的模块\\文本处理";
#获取文件夹下所有内容


#http://www.17500.cn/p5/all.php?p=5

foreach my $index(1..200)
{
 $url=$src."?p=".$index;
 my @FileContent;
 #print "usl is $url\n";
  #my $input = <STDIN>;
 my $content = get $url;
 die "Couldn‘t get $url" unless defined $content;
 #  $content 里是网页内容,下面是对此内容作些分析:
 #print $content ;
 my $WriteFilePath = $index.".txt";
 push @FileContent,$content;
FileOperate->WriteFileContent($WriteFilePath,@FileContent);
undef @FileContent;

}

 my $input = <STDIN>;
 if($content =~ m/jazz/i) {
   print "They‘re talking about jazz today on Fresh Air!/n";
 } else {
    print "Fresh Air is apparently jazzless today./n";
 }

本文出自 “风清扬song” 博客,请务必保留此出处http://2309998.blog.51cto.com/2299998/1533471

perl 抓取网页内容,布布扣,bubuko.com

perl 抓取网页内容

标签:perl抓网页

原文地址:http://2309998.blog.51cto.com/2299998/1533471

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!