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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。