  
- UID
- 1
- 威望
- 1240 点
- 金钱
- 24019 金币
- 点卡
- 317 点
|
1#
发表于 2005-8-25 19:54
| 只看该作者
一个程序自动刷新页面的例子
作者:小歪歪
日期:2001-1-12 15:49:23- #!/usr/bin/perl
- use HTTP::Request;
- use LWP::UserAgent;
- my $ua = new LWP::UserAgent;
- $|=1;
- print "content-type:text/html\n\n";
- $ua->agent("AgentName/1.0 " . $ua->agent);
- $ua->timeout(80);
- # Create a request
- my $req = new HTTP::Request POST => ';http://search.sina.com.cn/cgi-bin/search/search.cgi';;
- $req->content_type(';application/x-www-form-urlencoded';);
- my $buffer="ss=sina&_searchkey=%BB%EE%B6%AF%2B%BD%B1%CF%EE&_andor=and&s1=%CB%D1%CB%F7";
- $req->content($buffer);
- # Pass request to the user agent and get a response back
- my $res = $ua->request($req);
- # Check the outcome of the response
- if ($res->is_success) {
- print length($res->content);
- print <<END;
- <META HTTP-EQUIV="Refresh" Content=1;Host="http://***.***.***.***/nperl/autorefresh.pl">
- END
- ;
- print $res->content ;
-
- } else {
- print "bad luck";
- }
复制代码 ——————以下内容由Cnangel在2005年08月25日 07:59pm时添加———————
不怎么高明,Perl是写socket的高手,为什么不用呢? |
我是一个呼吸着现在的空气而生活在过去的人
这样的注定孤独,孤独的身处闹市却犹如置身于荒漠
我已习惯了孤独,爱上孤独
他让我看清了自我,还原了自我
让我再静静的沉思中得到快乐和满足
再孤独的世界里我一遍又一遍
不厌其烦的改写着自己的过去
延伸到现在与未来
然而那只是泡沫般的美梦
产生的时刻又伴随着破灭的到来
在灰飞烟灭的瞬间我看到的是过程的美丽
而不是结果的悲哀。。。
|
|