Chinaunix首页 | 论坛 | 博客
  • 博客访问: 134331
  • 博文数量: 57
  • 博客积分: 2500
  • 博客等级: 少校
  • 技术积分: 580
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-04 22:57
文章分类

全部博文(57)

文章存档

2011年(1)

2010年(1)

2009年(55)

我的朋友

分类:

2009-02-27 16:43:38

写了一个perl脚本来监听   的最新消息,最近办理房产证的事情把我们业主给搞惨了。该死的kfs。
 

#!C:\strawberry\perl\bin\perl.exe
use warnings;
use strict;
use LWP::UserAgent;
use CGI;

#
#
# 家园动态
#
my $cgi = CGI->new();

my $ua = LWP::UserAgent->new('agent' => 'Mozilla/5.0');
my $page_response = $ua->get('');
die 'Http get failed', "\n" unless $page_response->is_success;
my @lks = ();
my $nd = $cgi->param('d') || 3;
for ($page_response->content =~ m/(<tbody id=\"(normal|stick)thread_\d+\" >.*?<\/tbody>)/sg) {
    s#\n##gs;
    s#href="
#href="
    s#src="#src="
    for (my $i = 0; $i < $nd; $i++) {
        my (undef,undef,undef,$_d,$_m,$_y,undef,undef,undef) = localtime(time - 3600 * 24 * $i);
        $_y += 1900;
        $_m += 1;
        push @lks, $_ if m/<em>$_y-$_m-$_d<\/em>/;
    }
}
print $cgi->header('text/html; charset=utf-8');
print qq(
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta http-equiv="Content-Language" content="zh-CN" />
 <meta http-equiv="Refresh" content="60" />
 <meta name="Keywords" content="" />
 <meta name="Description" content="" />
 <title>perl FOR hlghome</title>
 <style>
 body {font-size: 12px; margin: auto; text-align: center;}
 img {border: none;}
 a, a:visited {color: blue;}
 table {border: 1px solid gray; margin: 10px auto;}
 </style>
</head>
<body>
);
print "

", "\n";
for (@lks) {
    print $_, "\n";
}
print "
", "\n";
print qq(
</body>
</html>
);

阅读(591) | 评论(1) | 转发(0) |
0

上一篇:js设计模式笔记001

下一篇:一腾讯试题

给主人留下些什么吧!~~

chinaunix网友2009-02-27 16:46:12

cublog的perl代码语法彩色怎么解析成这样...