欢迎光临
我们一直在努力

一个程序自动刷新页面的例子(例如搜新浪小人)-CGI教程,CGI文档

建站超值云服务器,限时71元/月

#!/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";
  }

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 一个程序自动刷新页面的例子(例如搜新浪小人)-CGI教程,CGI文档
分享到: 更多 (0)