Objectmovedtohere appears during php simulated login, with the addition of curl_setopt ($ ch, CURLOPTFOLLOWLOCATION, 1 );
One student is exploring for himself. I hope the experts will give me some guidance in their busy schedule and I don't know where the problem has occurred.
Simulate logon to the Educational Administration website.
Educational website http://xk.shnu.edu.cn: 82/index. aspx
Testing account 120154728 123612
Login interface
ABind student ID
Last 6 digits of the initial password ID card
Get verification code
Post page
"3153600","txtUserID"=>$user,"txtUserPwd"=>$password,"txtValidateCode"=>$yzm); $ch = curl_init($login_url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPTFOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); curl_exec($ch); curl_close($ch); $url='http://xk.shnu.edu.cn:82/index.aspx'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);curl_setopt($ch, CURLOPTFOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); $contents = curl_exec($ch); curl_close($ch);?>
Reply to discussion (solution)
Help me
CURLOPTFOLLOWLOCATION
Should be
CURLOPT_FOLLOWLOCATION
And the execution order of your code.
Curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, 1 );
And your verification code does not need to be obtained by curl. Direct
You can.
CURLOPTFOLLOWLOCATION
Should be
CURLOPT_FOLLOWLOCATION
And the execution order of your code.
What is the code execution order? Is there any other problem with the code?
Now there is no redirection information, but the page is still not displayed.
And your verification code does not need to be obtained by curl. Direct
You can.
So how do I know whether the verification code is consistent with that on the website? Now it's like this.
Curl access http://xk.shnu.edu.cn: 82/index. aspx for getting cookies
Parse the verification code Image address
Enter user information and verification code value on the form page
Curl submission
Curl access http://xk.shnu.edu.cn: 82/index. aspx for getting cookies
Parse the verification code Image address
Enter user information and verification code value on the form page
Curl submission
My process is like this. the simulated page is not personal information, just like the page generated by directly entering the URL in the address bar.
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookie_file) is available only for the first time in the process );
No cookie will be available in the future. Otherwise, the cookie read will change.
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookie_file) is available only for the first time in the process );
No cookie will be available in the future. Otherwise, the cookie read will change.
I am new to contact or do not understand
Does it mean that curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookie_file) is no longer required on my post page?
And your verification code does not need to be obtained by curl. Direct
You can.
How do I know that curl is not required for the verification code?
Curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, 1 );
Did my user name and password verification code fail to be passed in?
I #7 didn't make it clear?
I #7 didn't make it clear?
My process should be what you said.
There are two hidden fields in the login form. Are you sure you want to transfer them?
There are two hidden fields in the login form. Are you sure you want to transfer them?
I cannot add a hidden value to the moderator.
"3153600","__VIEWSTATE"=>"/wEPDwUKMTU3NjIwMDY1MQ9kFgICAw9kFgQCEQ88KwAJAQAPFgQeCERhdGFLZXlzFgAeC18hSXRlbUNvdW50AghkFhBmD2QWAmYPFQQx5pys5a2m5pyf5a2m55Sf5oiQ57up6K+35LqOMjAxNOW5tDHmnIgyNuaXpeafpeivoggwMDAwMDAzMzHmnKzlrabmnJ/lrabnlJ/miJDnu6nor7fkuo4yMDE05bm0MeaciDI25pel5p+l6K+iCDIwMTQwMTE2ZAIBD2QWAmYPFQQ3MjAxMee6p+acrOenkeeUn+WPr+S7peWPguWKoOS4iua1t+W4gumrmOagoeWFseS6q+ivvueoiwgwMDAwMDAzMjcyMDEx57qn5pys56eR55Sf5Y+v5Lul5Y+C5Yqg5LiK5rW35biC6auY5qCh5YWx5Lqr6K++56iLCDIwMTMxMjIwZAICD2QWAmYPFQQd5Yid6YCJMjAxM+W5tDEy5pyIMTLml6XlvIDlp4sIMDAwMDAwMzEd5Yid6YCJMjAxM+W5tDEy5pyIMTLml6XlvIDlp4sIMjAxMzExMjh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U9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4ORIeDERlZmF1bHRWYWx1ZQVlIGlkX01zZyBpbiAoIHNlbGVjdCBpZF9Nc2cgZnJvbSBYeE1zZ05vdGlmeVJvbGUgd2hlcmUgUm9sZUlkID0gJzAwMDEwMDA1Jykgb3JkZXIgYnkgcmVsZWFzZWRhdGUgZGVzYyAeDlBhcmFtZXRlclZhbHVlZBQrAQECA2RkZGIgE9UDulG9GvRO4dsU+SdCCEFM","__EVENTVALIDATION"=>"/wEWBgKY0u7vCwLT8dy8BQLG8eCkDwKuqciQCQKC3IeGDAKO8J4Nk+MLn7wUWUDvvoz1eyVjqKX9ZAs=","pwuser"=>$user,"pwpwd"=>$password); $ch = curl_init($login_url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);curl_exec($ch); curl_close($ch); $url='http://xk.shnu.edu.cn:82/StudentManage/wfmXsStuBaseUpdate.aspx'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); $contents = curl_exec($ch); curl_close($ch);?>
On the pos page
$ Cookie_file = tempnam ('./temp', 'cooker ');
You are in the process of obtaining the verification code
$ Cookie_file = $ filedir. "/cookie.txt ";
Different cookie files are used throughout the process, and the cookie is obviously not consistent.
On the pos page
$ Cookie_file = tempnam ('./temp', 'cooker ');
You are in the process of obtaining the verification code
$ Cookie_file = $ filedir. "/cookie.txt ";
Different cookie files are used throughout the process. Obviously, the cookies cannot be consistent. I used firebug debugging to find that the hidden values were not passed in. why?
Other values are available, and the transmission mode is the same as other values.
$ User = $ _ POST ["stuno"]; $ password =$ _ POST ["stupwd"]; $ yzm =$ _ POST ["stuyzm"]; // echo $ user; // echo $ password; // echo $ yzm; $ cookie_file = tempnam ('. /temp ', 'cookier'); $ login_url =' http://xk.shnu.edu.cn:82/index.aspx '; $ Post_fields = array ("cktime" => "3153600 ", "_ VIEWSTATE" => "/records + Records/lrabnlJ/records + l6K + records + acrOenkeeUn + WPr + records + w4gumrmoagewfses6q + records + v5Lul5Y + records + expires + expires ++ 56iL6YCJ6K ++ expires + lCDAwMDAwMDMwc + WFs + expires/or7fms6jmhI/vvJrmnJ/expires + ivt + expires/h + expires + s4iua1t + w4gumrmoagewfses6q + ivvueoi + scheme + h5oGv5qC45a + scheme + WFs + scheme/kv6Hmga/scheme + SdCCEFM ", "_ EVENTVALIDATION" => "/login + login =", "btnLogin" => "login", "txtUserID" => $ user, "txtUserPwd" => $ password, "txtValidateCode" => $ yzm );
On the pos page
$ Cookie_file = tempnam ('./temp', 'cooker ');
You are in the process of obtaining the verification code
$ Cookie_file = $ filedir. "/cookie.txt ";
Different cookie files are used throughout the process, and the cookie is obviously not consistent.
The moderator now successfully simulated login. I later found that the query result does not require a verification code.
I just passed the hidden value into it.
But now another problem is that sometimes the score is displayed, and sometimes there is nothing