Chinaunix首页 | 论坛 | 博客
  • 博客访问: 517764
  • 博文数量: 126
  • 博客积分: 851
  • 博客等级: 准尉
  • 技术积分: 1287
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-06 11:21
个人简介

个人最新博客地址http://www.skylway.com/

文章分类

全部博文(126)

文章存档

2016年(2)

2014年(60)

2013年(35)

2012年(29)

分类: PERL

2013-06-14 15:34:01

#!/perl/bin/perl.exe
####################################
#author:make by skylway20130614
#useage:perl 138check.pl $number
#$number为电话号码
###################################
use strict;
use warnings;
use URI;
use Web::Scraper;
use Encode qw(encode decode);


my $file="C:/Users/Administrator/Desktop/mytest/web.log";
open(LOG ,">$file")||die "ERROR:cann't open $!";
my $number=$ARGV[0];
my $url   = "";
my $proce = scraper {   
    process '.tdc1',   "news[]"  => "TEXT";    
    process '.tdc >td', "texts[]" => "TEXT"; };
my $res = $proce->scrape( URI->new($url) );

foreach my $result (@{$res->{news}}) {
    $result=encode("gbk",$result);
    $result=~s/\?//g;
    print LOG "$result\n";
    }

my @array;
foreach my $result (@{$res->{texts}}) {
    $result=encode("gbk",$result);
    $result=~s/\?//g;
    push @array,$result;
    print LOG "$result\n";
    }

print "$array[5]\n";
阅读(1408) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~