[問題] 登陸网站的問題

看板Perl作者 (華麗的黑色)時間19年前 (2006/08/08 11:18), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
我用LWP:UserAgent提供的方法登陸网站,卻總是不成功,特來請教各位 這是我的code ====================== use strict; use LWP::UserAgent; BEGIN {$LWP::DebugFile::outpath='../debug/'} use LWP::DebugFile; use HTTP::Cookies; my $browser=LWP::UserAgent->new; my $url='http://192.54.243.114/security/login/login.php?selectedLanguage=eng'; my $some_file = '../cookies/cookies.lwp'; my $cookie_jar = HTTP::Cookies->new(file=>$some_file,autosave=>1,); $browser->cookie_jar($cookie_jar); my $request=new HTTP::Request(POST=>$url); $cookie_jar->add_cookie_header($request); $request->content_type('application/x-www-form-urlencoded'); $request->content("userName=manager&userPwd=manager&login=Login"); my $resp=$browser->request($request); print $resp->as_string; ======================================================= 此网站的header ============================ HTTP/1.1 200 OK Cache-Control: no-cache, must-revalidate Connection: close Date: Thu, 10 Aug 2006 05:39:39 GMT Pragma: no-cache Server: Apache/1.3.27 (Unix) PHP/4.2.3 Content-Type: text/html Expires: Mon, 26 Jul 1997 05:00:00 GMT Last-Modified: Thu, 10 Aug 2006 05:39:39GMT Client-Date: Sat, 08 Jul 2006 03:28:01 GMT Client-Peer: 172.54.243.114:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked Set-Cookie: PHPSESSID=d285905c6fb3b9c663dbeecaae4432db; path=/ X-Powered-By: PHP/4.2.3 ========================================================== -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 202.134.119.18

08/14 01:03, , 1F
你所提供的站點我無法進行訪問! 80端口是否有開啟?
08/14 01:03, 1F
文章代碼(AID): #14s0AHS0 (Perl)
文章代碼(AID): #14s0AHS0 (Perl)