PHP simulation Landing The Dean appeared object moved to here, plus curl_setopt ($ch, curloptfollowlocation, 1);

Source: Internet
Author: User
Students, their own in the groping, hope that the great God is busy with guidance, do not know where the problem arises
Analog landing Educational website problems, ask the great gods

Academic website Http://xk.shnu.edu.cn:82/index.aspx
Test Account 120154728 123612
Login Interface
 
    ABinding study Number                
6 digits after initial password ID

Get Verification Code
 
  

Post page
 "3153600", "Txtuserid" and $user, "Txtuserpwd" and "$yzm" and $password, "Txtvalidatecode";    $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)

The great gods come and help.

Curloptfollowlocation
should be for
Curlopt_followlocation

And that's your code. Order of execution

curl_setopt ($ch, curlopt_followlocation, 1);

And your verification code doesn't need curl to get it. Direct
Can

Curloptfollowlocation
should be for
Curlopt_followlocation

And that's your code. Order of execution
What should be the order of code execution? Do you have any other questions about the code?
Now we've changed the message without redirection, but the page is still not showing.

And your verification code doesn't need curl to get it. Direct
Can
How do you know if the verification code is consistent with the site? Now it's going to be like this.

Curl accesses http://xk.shnu.edu.cn:82/index.aspx for cookie access
Parse out the Verification code picture address
Form page, fill in user information and verification code values
Curl Submit

Curl accesses http://xk.shnu.edu.cn:82/index.aspx for cookie access
Parse out the Verification code picture address
Form page, fill in user information and verification code values
Curl Submit
That's my process. The simulated page is not personal information as it was generated directly in the address bar.

Only the first time in the process is curl_setopt ($ch, Curlopt_cookiejar, $cookie _file);
You can't have any later, or the cookie you read will change.

Only the first time in the process is curl_setopt ($ch, Curlopt_cookiejar, $cookie _file);
You can't have any later, or the cookie you read will change.
Just touched or didn't understand
I don't need curl_setopt ($ch, Curlopt_cookiejar, $cookie _file) on my post page.

And your verification code doesn't need curl to get it. Direct
Can
How do you know if the verification code needs to be obtained by curl?

curl_setopt ($ch, curlopt_followlocation, 1);
My user name password verification code data is still not passed AH?

Did I #7 not to say it clearly?

Did I #7 not to say it clearly?
My process should be the way you say it.

There are two hidden fields in his login form, are you passing it?

There are two hidden fields in his login form, are you passing it?
Moderator I added the hidden value is still not

 "3153600", "__viewstate" and "="/ Wepdwukmtu3njiwmdy1mq9kfgicaw9kfgqceq88kwajaqapfgqecerhdgflzxlzfgaec18hsxrlbunvdw50aghkfhbmd2qwamypfqqx5pys5a2m5pyf5a2m55 sf5oiq57up6k+35lqomjaxnow5tdhmnigynuaxpeafpeivoggwmdawmdazmzhmnkzlrabmnj/lrabnlj/ mijdnu6nor7fkuo4ymde05bm0meacidi25pel5p+l6k+icdiwmtqwmte2zaibd2qwamypfqq3mjaxmee6p+acroenkeeun+wpr+ s7pewpguwkoos4iua1t+w4gumrmoagoewfses6q+ivvueoiwgwmdawmdazmjcymdex57qn5pys56er55sf5y+v5lul5y+ c5yqg5lik5rw35bic6auy5qch5ywx5lqr6k++56ilcdiwmtmxmjiwzaicd2qwamypfqqd5yid6ycjmjaxm+ w5tdey5pyimtlml6xlvidlp4simdawmdawmzed5yid6ycjmjaxm+ w5tdey5pyimtlml6xlvidlp4simjaxmzexmjhkagmpzbyczg8vbhplhbpkuo7mijhmokeymdex57qn5pys56er55sf5y+ c5yqg5lik5rw35bic6auy5qch5ywx5lqr6k++56il6ycj6k++ 4occ56gu6k6k44cb5ake6ycj44cb6yca5ps56ycj4ocd5bel5l2c55qe6yca55+lcdawmdawmdmwc+wfs+ s6juaikeagotiwmthnuqfmnkznp5hnlj/ Lj4lliqdkuirmtbfluilpq5jmokhlhbhkuqvor77nqivpginor77igjznoa7orqtjgihlop7pginjgihpgidmllnpginigj3lt6xkvzznmotpgjrnn6uimjax Mza5mdjkagqpzbyczg8vbctlrabnlj/or7fms6jmhi/vvjrmnj/mnkvmnidmlrdpgjrnn6uimdawmdawmjkk5a2m55sf6k+35roo5osp77ya5pyf5pyr5pya5paw6yca55+lcdiwmtmwnze2zaifd2qwamypfqqn6k+ 35zce5l2n5zcm5a2m5lin6kab6zsz6l+h5asn6ycj5pe26ze0cdawmdawmdi4j+ivt+wqhos9jewqjowtpus4jeimgemumei/h+ wkjemaieaxtumxtagymdezmdyyngqcbg9kfgjmdxuej+s4iua1t+w4gumrmoagoewfses6q+ivvueoi+ Maieivvumamuefpqgwmdawmdaynyfkuirmtbfluilpq5jmokhlhbhkuqvor77nqivpginor77pgjrnn6uimjaxmza2mjfkagcpzbyczg8vbdflhbpkuo4ymde z5bm056el5a2j5ywl5a2m5paw55sf5l+h5ogv5qc45a+55pon5l2c5oyh5y2xcdawmdawmde2n+wfs+ s6jjiwmtplubtnp4vlraplhaxlrabmlrdnlj/kv6hmga/ Moljlr7nmk43kvzzmjifljzcimjaxmza5mdzkahmpd2qpdxqraaewcb4etmftzqulc3ryq29uzhrpb24ebfr5cgulkvxtexn0zw0uvhlwzunvzgusig1zy29y Bglilcbwzxjzaw9uptiumc4wljasien1bhr1cmu9bmv1dhjhbcwguhvibgljs2v5vg9rzw49yjc3ytvjntyxotm0zta4oriederlzmf1bhrwywx1zqvliglkx 01zzybpbiaoihnlbgvjdcbpzf9nc2cgznjvbsbyee1zz05vdglmevjvbgugd2hlcmugum9szulkid0gjzawmdewmda1jykgb3jkzxigynkgcmvszwfzzwrhdg Ugzgvzyyaedlbhcmftzxrlclzhbhvlzbqraqeca2rkzgige9udulg9gvro4dsu+sdccefm "," __eventvalidation "="/ Wewbgky0u7vcwlt8dy8bqlg8eckdwkuqciqcqkc3iegdako8j4nk+mln7wuwudvvoz1eyvjqkx9zas= "," pwuser "= $user," Pwpwd "and" The $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);? >

You are in the POS page
$cookie _file = Tempnam ('./temp ', ' Cookie ');
You're getting a captcha.
$cookie _file = $filedir. " /cookie.txt ";

Different cookie files are used throughout the process, and it is clearly not guaranteed that the cookie is consistent

You are in the POS page
$cookie _file = Tempnam ('./temp ', ' Cookie ');
You're getting a captcha.
$cookie _file = $filedir. " /cookie.txt ";

Different cookie files are used throughout the process, and obviously there is no guarantee that the cookie is consistent. I used Firebug debugging to find that hidden values did not pass in, why AH?
The other values are the same as the others.

$user =$_post["Stuno"), $password =$_post["Stupwd"), $yzm =$_post["Stuyzm"];//echo $user;//echo $password;//echo $yzm; $cookie _file = Tempnam ('./temp ', ' Cookie '), $login _url = ' http://xk.shnu.edu.cn:82/index.aspx '; $post _fields = Array (" Cktime "" and "3153600", "__viewstate" and "="/ Wepdwukmtu3njiwmdy1mq9kfgicaw9kfgqceq88kwajaqapfgqecerhdgflzxlzfgaec18hsxrlbunvdw50aghkfhbmd2qwamypfqqx5pys5a2m5pyf5a2m55 sf5oiq57up6k+35lqomjaxnow5tdhmnigynuaxpeafpeivoggwmdawmdazmzhmnkzlrabmnj/lrabnlj/ mijdnu6nor7fkuo4ymde05bm0meacidi25pel5p+l6k+icdiwmtqwmte2zaibd2qwamypfqq3mjaxmee6p+acroenkeeun+wpr+ s7pewpguwkoos4iua1t+w4gumrmoagoewfses6q+ivvueoiwgwmdawmdazmjcymdex57qn5pys56er55sf5y+v5lul5y+ c5yqg5lik5rw35bic6auy5qch5ywx5lqr6k++56ilcdiwmtmxmjiwzaicd2qwamypfqqd5yid6ycjmjaxm+ w5tdey5pyimtlml6xlvidlp4simdawmdawmzed5yid6ycjmjaxm+ w5tdey5pyimtlml6xlvidlp4simjaxmzexmjhkagmpzbyczg8vbhplhbpkuo7mijhmokeymdex57qn5pys56er55sf5y+ C5yqg5lik5rw35bic6auy5qch5ywx5lqr6k++56il6ycj6k++4occ56gu6k6k44cb5ake6ycj44cb6yca5ps56ycj4ocd5bel5l2c55qe6yca55+lcdawmdawmdmwc+wfs+s6juaikeagotiwmthnuqfmnkznp5hnlj/ Lj4lliqdkuirmtbfluilpq5jmokhlhbhkuqvor77nqivpginor77igjznoa7orqtjgihlop7pginjgihpgidmllnpginigj3lt6xkvzznmotpgjrnn6uimjax mza5mdjkagqpzbyczg8vbctlrabnlj/or7fms6jmhi/vvjrmnj/mnkvmnidmlrdpgjrnn6uimdawmdawmjkk5a2m55sf6k+ 35roo5osp77ya5pyf5pyr5pya5paw6yca55+lcdiwmtmwnze2zaifd2qwamypfqqn6k+35zce5l2n5zcm5a2m5lin6kab6zsz6l+ H5asn6ycj5pe26ze0cdawmdawmdi4j+ivt+wqhos9jewqjowtpus4jeimgemumei/h+wkjemaieaxtumxtagymdezmdyyngqcbg9kfgjmdxuej +s4iua1t+w4gumrmoagoewfses6q+ivvueoi+ Maieivvumamuefpqgwmdawmdaynyfkuirmtbfluilpq5jmokhlhbhkuqvor77nqivpginor77pgjrnn6uimjaxmza2mjfkagcpzbyczg8vbdflhbpkuo4ymde z5bm056el5a2j5ywl5a2m5paw55sf5l+h5ogv5qc45a+55pon5l2c5oyh5y2xcdawmdawmde2n+wfs+ s6jjiwmtplubtnp4vlraplhaxlrabmlrdnlj/kv6hmga/ Moljlr7nmk43kvzzmjifljzcimjaxmza5mdzkahmpd2qpdxqraaewcb4etmftzqulc3ryq29uzhrpb24ebfr5cgulkvxtexn0zw0uvhlwzunvzgusig1zy29y Bglilcbwzxjzaw9uptiumc4wljasien1bhr1cmu9bmv1dhjhbcwguhvibgljs2v5vg9rzw49yjc3ytvjntyxotm0zta4oriederlzmf1bhrwywx1zqvLiglkx01zzybpbiaoihnlbgvjdcbpzf9nc2cgznjvbsbyee1zz05vdglmevjvbgugd2hlcmugum9szulkid0gjzawmdewmda1jykgb3jkzxigynkgcmvszwfz Zwrhdgugzgvzyyaedlbhcmftzxrlclzhbhvlzbqraqeca2rkzgige9udulg9gvro4dsu+sdccefm "," __EVENTVALIDATION "="/ Wewbgky0u7vcwlt8dy8bqlg8eckdwkuqciqcqkc3iegdako8j4nk+mln7wuwudvvoz1eyvjqkx9zas= "," BtnLogin "and" Login "," Txtuserid "" and $user, "Txtuserpwd" and "Txtvalidatecode", "$yzm" and $password;

You are in the POS page
$cookie _file = Tempnam ('./temp ', ' Cookie ');
You're getting a captcha.
$cookie _file = $filedir. " /cookie.txt ";

Different cookie files are used throughout the process, and it is clearly not guaranteed that the cookie is consistent
Moderator I now simulated landing success, I later found that the query results do not require verification code
I just put the hidden values in, and it's OK.
But now there's a problem with showing results sometimes, and sometimes there's nothing.

  • Related Article

    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.