动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
   Cgi/Perl → 阅读文章

 一个程序自动刷新页面的例子(例如搜新浪小人)

作者来源: 
阅读 1840 人次 , 2006-4-19 18:06:00 


   #!/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";
  }   
 
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:例子(请多多指教)
· 下一篇:尝试用sql查询语句操纵普通文本数据库!使用简单的select就可以实现文本的索引访问,用update……
· CGI计数器的编写方法
· Cgi入门教程之:1 Unix环境
· CGI教程(9)编写安全的CGI脚本
· 快速开始Perl XML:接口篇
· PERL与MySQL(三、DBI接口)


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077