会员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信息,但是过一阵又不能正确返回,为什么会出现这种情况, 希望有大虾能帮我看看是怎么回事? 急
回复讨论(解决方案)
百度了一下ems的查询,有不少连接是抱怨无法查询的。
所以我怀疑ems,并没有把银子花在公众查询服务器上,在高负载下,服务器有些吃力。
应该是服务器的问题。
这个问题没法解决吗,具体发生的原因是什么? 因为有的时间段又是可以的,如果我不通过Snoopy,而是直接通过火狐浏览器访问EMS的网址,通过工具查看COOKIE,实际上里面还是会产生一个JESSIONID,为什么通过Snoopy 就获取不到这个JessionID呢?
life169。麻烦再帮我解答一下这个疑问?
昨天我也在firefox里测试了一会,还好,连续刷新都抓到了sesssionid
你说的这个现象,我以前也碰到,至今无解。
用curl吧,比snoopy稳定得多,也强大得多。在csdn里有我的源码
你好,能不能告诉你写的关于curl具体的文章链接?我没找到
另外,使用CURL 也能实现Snoopy 实现的这个EMS查询功能吗?好像贴里你有说用CURL测试成功,能否提供一下你的源码给到我参考一下。
我的邮箱是:59325460@qq.com
已经发到你的邮箱里了
life169, 非常感谢,收到你的源码,不过在使用CURL测试过程中,仍然不能返回正确数据,总是提示“页面停留时间过长导致邮件查询标志丢失,请刷新查询页面。”
搞不明白是怎么回事,还请继续指点迷津。
恩 以前做的代码不能用了
ems的查询地址变了,
也多了两个提交所需要的数据
reqCode browseBASE
myEmsbarCode 7967913886707
mailNum EE082209212CS
E4E5AFF694E4FAD581D8FC8 vpc9
optijiaot.x 15
optijiaot.y 13
这个是以前没有的 像是由js生成的,原文件里看不见。
那现在要怎么改,才能通过CURL的方式正确的获取到内容,Snoopy如果可以获取到JSESSIONID,就可以正确获取到数据。
你给我的源码需要改哪些地方吗
查询地址我之前就已经改过了,然后我觉着既然之前通过Snoopy有时可以正确查询, 可以得知CURL不成功 可
能与新增加的两个提交所需要的数据没有太大的关系,可能是其它方面的需要设置,测试的时候,
testcookie.txt 并不能生成,只会生成一个testcookiebb.txt 文件,以前从来没玩过CURL,希望
life169能帮我解决这个问题。。。
恩 现在有点忙 晚上 我弄个完整版的代码给你
好的,非常感谢life169,在这个问题上我已经整了快三天时间了!有点抓狂了。
life169,完整版的代码搞好了吗?
恩 好了 到这里下吧
http://download.csdn.net/source/3100240
太感谢了,我先测试。
测试完结,太完美了,可以正确稳定的采集EMS的数据。感谢life169,帮我了一个大忙。
life169 你好,我下载的程序,结果报错,能给我发一个新的吗pangz@sohu.com 谢谢
sea1126 你好,能把你运行成功的代码发给我吗,我运行的结果是报错,谢谢,
pang@sohu.com
恩 好了 到这里下吧
http://download.csdn.net/source/3100240
life169,您好,你这个代码我测试成功了,但是更进一步,可以绕过输入验证码这个环节么?你这个程序还是需要输入验证码的!
谢谢哥哥
能发个给我吗? 我太需要这个了。 fob001@qq.com
能给我发一份吗?我也需要这个,谢谢!
yuxianhua@vip.qq.com
我也需要 bilwy@vip.qq.com 谁有发我一份
5分啊,穷人下不起啊,发份给我好么?1991753135@qq.com,谢谢

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor
