Urgent: Use Snoopy grab EMS verification Code, remote analog query number, unable to get jsessionid problem?

Source: Internet
Author: User
Member life169 before in the PHP section sent an article called (with Snoopy to crawl EMS verification Code, remote simulation query number, get query results)
Link is: http://topic.csdn.net/u/20100715/23/d58f2006-40ea-4cab-82e3-3bbcf4cd1e9f.html


But I encountered a problem in the process of testing, jsessionid, often will not be taken,

Session_Start ();
Include ("Snoopy.class.php");
$url = "Http://www.ems.com.cn/qcgzOutQueryNewAction.do?reqCode=gotoSearch";
$url 2 = "http://www.ems.com.cn/qcgzOutQueryNewAction.do";

$snoopy = new Snoopy;
$snoopy->fetch ($url); Get all content
Print_r ($snoopy->headers);

The print header information, which is returned:
Array ([0] = http/1.1-OK [1] = content-type:text/html; charset=gb2312 [2] = = x-powered-by:servlet/2.4 JS p/2.0 [3] = accept-ranges:bytes [4] = connection:close [5] = Date:tue, [Mar] 11:24:53 GMT [6] = A ge:1876 [7] = content-length:22804)

The correct return information should be:
Array ([0] = http/1.1-OK [1] = cache-control:no-cache= "Set-cookie" [2] = connection:close [3] = Dat E:fri, Mar 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)

The back of the inside no jsessionid, resulting in the query in the back of the query results can not be returned, I have been the whole 2 days, in the Internet to check a large amount of information, or no clue, there is now a strange phenomenon, If the browser opens the Ems.php page, after a period of time and then refresh the page, will return the correct headers information, but after a while can not be returned correctly, why this situation, I hope that there are prawns can help me see what is going on? Tokyu


Reply to discussion (solution)

Baidu has a bit of EMS query, there are a lot of connections are complaining can not query.
So I suspect EMS, and did not spend money on the public query server, under high load, the servers are a bit hard.

Should be a problem with the server.

This problem can not be solved, the specific reason for what happened? Because some time period is also possible, if I do not through the Snoopy, but directly through the Firefox browser to access the website of the EMS, through the tool to view the cookie, in fact, there will be a jessionid, why not get this Jessionid through Snoopy?

life169. Could you please help me to answer this question?

Yesterday I also tested in Firefox for a while, fortunately, successive refreshes have caught the Sesssionid
You said this phenomenon, I have encountered before, so far no solution.

With curl, it's much more stable and powerful than Snoopy. There's my source code in CSDN.

Hello, can you tell me the link to the specific article about curl? I didn't find it.

In addition, using curl can also achieve the Snoopy implementation of this EMS query function? As if you have said that with Curl test success, can provide your source for reference to me.

My e-mail is: 59325460@qq.com

It's been sent to your mailbox.

life169, thank you very much, received your source code, but in the use of Curl test process, still can not return the correct data, always prompt "page dwell time too long cause the message query flag is lost, please refresh the query page." ”

Do not understand what is going on, please continue to guide the maze.

Well, the code you used to do was useless.
The query address of EMS has changed,
and two more data to submit.

Reqcode Browsebase
Myemsbarcode 7967913886707
Mailnum Ee082209212cs
E4e5aff694e4fad581d8fc8 VPC9
Optijiaot.x 15
Optijiaot.y 13

This is not before the image is generated by JS, the original file is not visible.

Now how to change, in order to get the content by curl correctly, Snoopy if you can get to Jsessionid, you can get the data correctly.

What do you need to change the source code to me?

Query address I have been changed before, and then I feel that since the previous through the Snoopy can sometimes be correctly queried, you can know that curl is not successful can

It is not too much to relate to the data needed for the new two submissions, it may be necessary to set up other

Testcookie.txt does not generate, only generates a Testcookiebb.txt file, never played curl before, hoping

Life169 can help me solve this problem ...

Yes, I'm a little busy at the moment, I'll get you a full version of the code.

OK, thank you very much, life169, I have been on this issue for almost three days! A little freaked out.

life169, is the full version of the code good?

Yes, well, let's get down here.

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

Thank you so much, I'll test it first.

The test is complete, it is perfect, the data of EMS can be collected correctly and stably. Thanks to life169, it has helped me a great favor.

life169 Hello, I downloaded the program, the results of an error, can I send a new pangz@sohu.com thank you

sea1126 Hello, can you run the success of the code sent to me, I run the result is an error, thank you,
Pang@sohu.com

Yes, well, let's get down here.

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

life169, Hello, you this code I test successfully, but further, you can bypass the input verification code this link? You still need to enter the verification code of this program!

Thanks, brother.

Can you send me one? I need this too much. Fob001@qq.com

Can you send me a copy? I need this, too, thank you!

Yuxianhua@vip.qq.com

I also need bilwy@vip.qq.com who has sent me a copy

5 points Ah, the poor can't afford to give me a copy, okay? 1991753135@qq.com, thank you.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.