急用snoopy抓取EMS验证码,远程模拟查询单号,无法获取JSessionID的有关问题

WBOY
Release: 2016-06-13 10:06:21
Original
1168 people have browsed it

急:用snoopy抓取EMS验证码,远程模拟查询单号,无法获取JSessionID的问题?
会员life169之前在PHP版块发过一篇文章叫(用snoopy抓取EMS验证码,远程模拟查询单号,取得查询结果)
链接是:http://topic.csdn.net/u/20100715/23/d58f2006-40ea-4cab-82e3-3bbcf4cd1e9f.html


可是我在测试的过程中却遇到一个问题,JsessionID,经常会取不到,

session_start(); 
include("Snoopy.class.php"); 
$url = "http://www.ems.com.cn/qcgzOutQueryNewAction.do?reqCode=gotoSearch"; 
$url2 = "http://www.ems.com.cn/qcgzOutQueryNewAction.do"; 

$snoopy = new Snoopy;
$snoopy->fetch($url); //获取所有内容 
print_r($snoopy->headers);

打印头信息,返回的是:
Array ( [0] => HTTP/1.1 200 OK [1] => Content-Type: text/html; charset=GB2312 [2] => X-Powered-By: Servlet/2.4 JSP/2.0 [3] => Accept-Ranges: bytes [4] => Connection: close [5] => Date: Tue, 15 Mar 2011 11:24:53 GMT [6] => Age: 1876 [7] => Content-Length: 22804 ) 

正确的返回信息应当是:
Array ( [0] => HTTP/1.1 200 OK [1] => Cache-Control: no-cache="set-cookie" [2] => Connection: close [3] => Date: Fri, 11 Mar 2011 07:42:04 GMT [4] => Content-Type: text/html; charset=GB2312 [5] => Set-Cookie: JSESSIONID=N5SMs1dMW1Wy8LJ48Z1ZhP1p2kS1GSgY5twTNxcYpz1MvgYZk0LQ!195316506; path=/ [6] => X-Powered-By: Servlet/2.4 JSP/2.0 ) 

前面返回的里面没有JSESSIONID, 导致在后面的查询中返回不了查询结果, 我已经整了2天了,在网上查了大量资料,还是没有头绪,现在有一个奇怪现象,如果在浏览器打开ems.php页面,过一段时间再刷新页面后,又会返回正确的headers信息,但是过一阵又不能正确返回,为什么会出现这种情况, 希望有大虾能帮我看看是怎么回事? 急



------解决方案--------------------
恩 好了 到这里下吧

http://download.csdn.net/source/3100240

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template