For the PHPcurl packet capture problem, curl is used to capture web pages, books, scores, and course tables. However, it cannot be captured, and a 500 error is reported.
This is the page captured by the httpwatch packet capture tool. the cookie is obtained correctly.
This is the interface to capture. data is transmitted through post.
PHP code
Error Page
Reply to discussion (solution)
First, try with CURLOPT_REFERER. Is it possible that the other party has determined the page source?
Second, whether the other party's login page has hidden parameters. If yes, you need to visit the login page to obtain hidden values before submitting
Third: I didn't see where you submitted the login account and password, that is, the account and password posted here.
$ Url = "http: // 202.117.64.25/loginAction. do ";
$ Fields = "dllx = dldl & zfar = 201224080126 & mm = 201224080126 ";
Here is the account submission and password!
What should CURLOPT_REFERER add?
Find two hidden parameters, but it seems useless.
First, try with CURLOPT_REFERER. Is it possible that the other party has determined the page source?
Second, whether the other party's login page has hidden parameters. If yes, you need to visit the login page to obtain hidden values before submitting
Third: I didn't see where you submitted the login account and password, that is, the account and password posted here.
$ Url = "http: // 202.117.64.25/loginAction. do ";
$ Fields = "dllx = dldl & zfar = 201224080126 & mm = 201224080126 ";
Here is the account submission and password!
What should CURLOPT_REFERER add?
Find two hidden parameters, but it seems useless.
You have tested it for a while. it is okay to log on successfully. The main problem lies in the parameters of your second request. check the parameters, capture all the parameters on your second page, and the JAVA error is not very understandable!
You have tested it for a while. it is okay to log on successfully. The main problem lies in the parameters of your second request. check the parameters, capture all the parameters on your second page, and the JAVA error is not very understandable!
Have you captured it successfully?
Let's take a look. what's going on ???
Your process and code have problems! The correct process should be:
1. access http: // 202.117.64.25/
Obtain the cookie. Because his sessionid is sent on this page
2. access http: // 202.117.64.25/loginAction. do and send the post form data.
3. step 3 returns a framework page. you need to enter a framework as needed.
For example, you can access http: // 202.117.64.25/menu/s_top.jsp to get the logged-on information: Welcome to Huang Xiaolong.
Test Code
<? Phpinclude 'curl/curl_get.php '; $ url =' http://202.117.64.25/ '; Curl_get ($ url); $ url =" http://202.117.64.25/ LoginAction. do "; $ d = 'dllx = dldl & zlow = 201224080126 & mm = 100'; curl_get ($ url, $ d); echo curl_get (' http://202.117.64.25/ Menu/s_top.jsp '); echo curl_get (' http://202.117.64.25/ Menu/mainFrame. jsp '); echo curl_get (' http://202.117.64.25/ XsxxviewAction. do '); </pre> <br/> curl_get.php <pre class = "sycode" name = "code"> <? Phpfunction curl_get ($ durl, $ data = array () {$ cookiejar = realpath('cookie.txt '); $ t = parse_url ($ durl); $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, $ durl); curl_setopt ($ ch, CURLOPT_TIMEOUT, 5); curl_setopt ($ ch, hour, 0); curl_setopt ($ ch, CURLOPT_USERAGENT, $ _ SERVER ['http _ USER_AGENT ']); curl_setopt ($ ch, CURLOPT_REFERER, "HTTP: // $ t [host]/"); curl_setopt ($ ch, CURLOPT_COOKIEFILE, $ Cookiejar); curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookiejar); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ ch, CURLOPT_ENCODING, 1 ); // gzip decoding curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true); if ($ data) {curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ data) ;}$ r = curl_exec ($ ch); curl_close ($ ch); return $ r ;} </pre> </p> <p class = "sougouAnswer"> <p class = "yy"> your There are problems with the process and code! The correct process should be: <br/> 1. access http://202.117.64.25/ <Br/> obtain the cookie. Because his sessionid is issued on this page <br/> 2. access http://202.117.64.25/ LoginAction. do and send post form data <br/> 3. step 3 returns a framework page. you must enter a framework as needed. <br/> For example http://202.117.64.25/ Menu/s_top.jsp can get the logged-on information: Welcome to & nbsp; Huang Xiaolong <br/> test code <pre class = "sycode" name = "code"> <xmp> <? Phpinclude 'curl/curl_get.php '; $ url =' http://202.117.64.25/ '; Curl_get ($ url); $ url =" http://202.117.64.25/ LoginAction. do "; $ d = 'dllx = dldl & zlow = 201224080126 & mm = 100'; curl_get ($ url, $ d); echo curl_get (' http://202.117.64.25/ Menu/s_top.jsp '); echo curl_get (' http://202.117.64.25/ Menu/mainFrame. jsp '); echo curl_get (' http://202.117.64.25/ XsxxviewAction. do '); </pre> <br/> curl_get.php <pre class = "sycode" name = "code"> <? Phpfunction curl_get ($ durl, $ data = array () {$ cookiejar = realpath('cookie.txt '); $ t = parse_url ($ durl); $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, $ durl); curl_setopt ($ ch, CURLOPT_TIMEOUT, 5); curl_setopt ($ ch, hour, 0); curl_setopt ($ ch, CURLOPT_USERAGENT, $ _ SERVER ['http _ USER_AGENT ']); curl_setopt ($ ch, CURLOPT_REFERER, "HTTP: // $ t [host]/"); curl_setopt ($ ch, CURLOPT_COOKIEFILE, $ Cookiejar); curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookiejar); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ ch, CURLOPT_ENCODING, 1 ); // gzip decoding curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true); if ($ data) {curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ data) ;}$ r = curl_exec ($ ch); curl_close ($ ch); return $ r ;}</pre> </p> <br/> Thank you very much, but I still don't know why? <Br/> This is my final code <br/> <pre class = "sycode" name = "code"> <? Phpinclude './curl/curl_get.php'; $ url =" http://202.117.64.25/ LoginAction. do "; $ d = 'dllx = dldl & zlow = 201224080126 & mm = 100'; curl_get ($ url, $ d); echo curl_get (' http://202.117.64.25/ XszxcxAction. do? Required = tjcx ', 'zxxnxq = 2014-2015-1-1 & zxXaq = 0 & zxJxl = 0011 & zxZc = 11 & zxJc = 2 & zxxq = 2 & pageSize = 20 & page = 1 & currentPage = 1 & pageNo = ');?> </Pre>