PHP simulation post to get JSP query data, using curl, there is a problem, ask for advice

Source: Internet
Author: User
Want to use curl to get JSP page query results via PHP.
The correct result should be (direct input from the official website):

A piece of code I wrote myself (using curl) has the following results:

Specific code:

I do not know why, I test the input data is: Invoice code: fpdm1=221011270133 Invoice Serial Number: fphm1=06649746

But I use curl to return the results and manual from the official Web query to the results are not the same, seek expert guidance, thank you!


Reply to discussion (solution)

Isn't he going to sign in? Also to install the control
Will you be able to access it without logging in?

Well, no login required.

$url = ' http://218.25.48.198/jsp/fpzjcx/fpzjcx_jg.jsp '; $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $url); curl_ Setopt ($ch, Curlopt_post, 1); curl_setopt ($ch, Curlopt_postfields, ' fpdm1=221011270133&fphm1=06649746 '); curl_ Setopt ($ch, Curlopt_returntransfer, 1); $data = Curl_exec ($ch); Echo $data;







<title>Shenyang Local Tax Invoice Lottery information query system</title>





























Query results

Hello, congratulations you have entered the No. 20130501 issue of the prize pool, you have 4 times to participate in the lottery, the draw number from 221011270133066497460001, draw number 221011270133066497460004, The draw date is June 2013 the second week of Wednesday, I wish you a prize.













That's what you need to log in to access.

So you first have to impersonate the login first

Khan, how do I put a hint to sign in?

"There is a problem with the online tax filing system, please close your browser and log back in later!" ”

Yes, direct access to http://218.25.48.198/jsp/fpzjcx/fpzjcx_jg.jsp is the cue.
Submit the past.

"There is a problem with the online tax filing system, please close your browser and log back in later!" ”

Oh, it has been successful. I didn't get the correct result because the parameter passed the wrong type.

Yes, direct access to http://218.25.48.198/jsp/fpzjcx/fpzjcx_jg.jsp is the cue.
Submit the past.


"There is a problem with the online tax filing system, please close your browser and log back in later!" ”

When you visited, it was just the wrong site.

The last effect, at the same time to everyone's help expressed thanks!

Ask the great God to teach me the same question. I also need to simulate the development of how the great God solved it. Attach My Code

$url = ' http://cx.ytjj.gov.cn:9081/ytjjvio/veh4tablevio.action?444 ';
$post _data= Array (
"Vehvio.hphm" = ' lu FZJ801 ',
"Vehvio.clsbdh" = ' 3235 ',
"Vehvio.hpzl" = "02"
);

$ch = Curl_init ();
Set the URL and the appropriate options
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, Curlopt_header, 0);
curl_setopt ($ch, Curlopt_post, 3);//set to POST mode
curl_setopt ($ch, Curlopt_returntransfer, true);
curl_setopt ($ch, Curlopt_postfields, "vehvio.hphm= fzj801&vehvio.clsbdh=3235&vehvio.hpzl=02");
curl_setopt ($ch, curlopt_encoding, "utf-8"); Here's the point.
Crawl the URL and pass it to the browser
$content = curl_exec ($ch);

Echo $content. "_";
Exit

Landlord, I want to simulate login a JSP Web page, can ask some questions

  • 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.