hb120973135 发表于 2018-8-31 10:37:04

LWP(Library for WWW in Perl)的基本使用

use LWP::UserAgent;  use LWP::ConnCache;
  #use HTTP::Cookies;
  $bro=LWP::UserAgent->new;
  $cache=LWP::ConnCache->new;
  #see the cookie file to change the ip address
  $ip="210.31.199.135";
  #$cookie=HTTP::Cookies->new(file=>'cookie.txt',autosave=>1);
  $bro->conn_cache($cache);
  $bro->cookie_jar($cookie);
  $url="http://www.gene-regulation.com/cgi-bin/pub/databases/transfac/getTF.cgi?AC=";
  #$bro->post("$login",["user"=>"chinaunix"],["password"=>"123456"]);
  for($i=1;$iget($full_url,'cookie'=>"Ticket=hash&a01d53e7f09e71bd2a7e0dd8af166632&time&1282744299&ip&$ip&user&chinaunix&expires&10");
  if($res->is_success){
  open($page,">","M00".$page.".html");
  print $page$res->content;
  close $page;
  print "downloading"."M00".$page."\n";
  }
  else{
  print "can't get page"
  }

页: [1]
查看完整版本: LWP(Library for WWW in Perl)的基本使用