Curl simulates the error of retrieving a password that cannot be understood

Source: Internet
Author: User
Tags set cookie ukey

Curl Simulation Recover password (Huaxia insurance) directly retrieve Password page http://www.ihxlife.com/forget ...
Enter phone number 15677748704 (test) Get verification code directly prompts for CAPTCHA error

But first enter the official website through the website link to enter the page can obtain the verification code

Through the code implementation first access to the main page to obtain a cookie and then take advantage of the cookie Access retrieve Password page update cookie
Then get the verification code —————— failed SMS verification code sent failed

 Public Function Forgetpwdindex () {$uKey = ' Huaxia '. Date ("Ymdhis"). Uniqid (); $cookieVerify = App_cookie. "/" . $uKey.        ". tmp";        $url = ' http://www.ihxlife.com/';//Login to the home page URL to obtain a cookie $this->getcookie ($url, $cookieVerify);//obtain a cookie on the login page        The cookie for retrieving the password page $pwdUrl = ' http://www.ihxlife.com/forget/forgetPwd ';        $ch = Curl_init ();        curl_setopt ($ch, Curlopt_url, $PWDURL); curl_setopt ($ch, Curlopt_useragent, ' mozilla/5.0 (Macintosh; Intel Mac OS X 10.10;        rv:40.0) gecko/20100101 firefox/40.0 ');        curl_setopt ($ch, Curlopt_ssl_verifypeer, 0);        curl_setopt ($ch, Curlopt_header, 0); curl_setopt ($ch, Curlopt_timeout, 120);        Set timeout limit to prevent dead loops curl_setopt ($ch, Curlopt_returntransfer, true); curl_setopt ($ch, Curlopt_httpheader, Array (' accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8 ', ' accept-encoding:gzip, deflate ', ' accept-language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3', ' connection:keep-alive ', ' Host:www.ihxlife.com ');        curl_setopt ($ch, Curlopt_referer, ' http://www.ihxlife.com/');        curl_setopt ($ch, Curlopt_cookiefile, $cookieVerify);        curl_setopt ($ch, Curlopt_cookiejar, $cookieVerify);        Curl_exec ($ch);        Curl_close ($ch); echo $cookieVerify. "
"; $this->assign (' key ', $uKey);//upload to page in page post the data set cookie file $this->display (); } public Function Sendpwdmobilecode () {if (I (' post.key ') = = ' | | I (' post.mobile ') = = ') {echo json_encode (' status ' = ' 10001 ', ' message ' = ' parameter error ')); Die } $requireUrl = ' http://www.ihxlife.com/sms/smsCode_Send ';//request Address $postData = ' mobile= '. I (' Post.mobile '). ' &busitype=10019&effectivetime=180 '; $cookieVerify = App_cookie. "/" . I (' Post.key '). ". tmp"; echo $cookieVerify. "
"; $referer = ' http://www.ihxlife.com/forget/forgetPwd '; echo $this->curlpost ($REQUIREURL, $postData, $cookieVerify, $referer, 30,true);}
Public Function GetCookie ($url, $cookieVerify) {echo $cookieVerify.
"; $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, Curlopt_useragent, ' mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) gecko/20100101 firefox/40.0 '); curl_setopt ($ch, Curlopt_ssl_verifypeer, 0); curl_setopt ($ch, Curlopt_header, 0); curl_setopt ($ch, Curlopt_httpheader, Array (' accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8 ', ' accept-encoding:gzip, deflate ', ' accept-language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3 ', ' Connection:keep-al Ive ', ' Host:www.ihxlife.com ')); curl_setopt ($ch, Curlopt_timeout, 120); Set timeout limit to prevent dead loops curl_setopt ($ch, Curlopt_returntransfer, true); curl_setopt ($ch, Curlopt_cookiejar, $cookieVerify); Curl_exec ($ch); Curl_close ($ch); Public Function Curlpost ($url, $post _fields, $cookieVerify, $referer = ", $timeOut = +, $header =") {$cur L = Curl_init (); curl_setopt ($curl, Curlopt_url, $url); curl_setopt ($curl, CUrlopt_ssl_verifypeer, 0); curl_setopt ($curl, Curlopt_ssl_verifyhost, 1); curl_setopt ($curl, Curlopt_useragent, ' mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) gecko/20100101 firefox/40.0 '); curl_setopt ($curl, curlopt_followlocation, 1); if ($referer) {curl_setopt ($curl, Curlopt_referer, $referer); } else {curl_setopt ($curl, Curlopt_autoreferer, 1); } if ($header) {//curl_setopt ($curl, Curlopt_httpheader, Array (' Host:www.ihxlife.com ', ' X-requested-with:xmlhtt Prequest ')); curl_setopt ($curl, Curlopt_httpheader, Array (' Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q =0.8 ', ' accept-encoding:gzip, deflate ', ' accept-language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3 ', ' content-type:application/x-www-form-urlencoded; Charset=utf-8 ', ' connection:keep-alive ', ' Host:www.ihxlife.com ', ' X-requested-with:xmlhtt Prequest ')); } curl_setopt ($curl, CURLOPT_POSTFIelds, $post _fields); curl_setopt ($curl, Curlopt_post, 1); curl_setopt ($curl, Curlopt_cookiefile, $cookieVerify); curl_setopt ($curl, Curlopt_cookiejar, $cookieVerify); curl_setopt ($curl, Curlopt_timeout, $timeOut); curl_setopt ($curl, Curlopt_header, 0); curl_setopt ($curl, Curlopt_returntransfer, 1); $resultData = curl_exec ($curl); Perform operation Curl_close ($curl); return $resultData;}

Reply content:

Curl Simulation Recover password (Huaxia insurance) directly retrieve Password page http://www.ihxlife.com/forget ...
Enter phone number 15677748704 (test) Get verification code directly prompts for CAPTCHA error

But first enter the official website through the website link to enter the page can obtain the verification code

Through the code implementation first access to the main page to obtain a cookie and then take advantage of the cookie Access retrieve Password page update cookie
Then get the verification code —————— failed SMS verification code sent failed

 Public Function Forgetpwdindex () {$uKey = ' Huaxia '. Date ("Ymdhis"). Uniqid (); $cookieVerify = App_cookie. "/" . $uKey.        ". tmp";        $url = ' http://www.ihxlife.com/';//Login to the home page URL to obtain a cookie $this->getcookie ($url, $cookieVerify);//obtain a cookie on the login page        The cookie for retrieving the password page $pwdUrl = ' http://www.ihxlife.com/forget/forgetPwd ';        $ch = Curl_init ();        curl_setopt ($ch, Curlopt_url, $PWDURL); curl_setopt ($ch, Curlopt_useragent, ' mozilla/5.0 (Macintosh; Intel Mac OS X 10.10;        rv:40.0) gecko/20100101 firefox/40.0 ');        curl_setopt ($ch, Curlopt_ssl_verifypeer, 0);        curl_setopt ($ch, Curlopt_header, 0); curl_setopt ($ch, Curlopt_timeout, 120);        Set timeout limit to prevent dead loops curl_setopt ($ch, Curlopt_returntransfer, true); curl_setopt ($ch, Curlopt_httpheader, Array (' accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8 ', ' accept-encoding:gzip, deflate ', ' accept-language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3', ' connection:keep-alive ', ' Host:www.ihxlife.com ');        curl_setopt ($ch, Curlopt_referer, ' http://www.ihxlife.com/');        curl_setopt ($ch, Curlopt_cookiefile, $cookieVerify);        curl_setopt ($ch, Curlopt_cookiejar, $cookieVerify);        Curl_exec ($ch);        Curl_close ($ch); echo $cookieVerify. "
"; $this->assign (' key ', $uKey);//upload to page in page post the data set cookie file $this->display (); } public Function Sendpwdmobilecode () {if (I (' post.key ') = = ' | | I (' post.mobile ') = = ') {echo json_encode (' status ' = ' 10001 ', ' message ' = ' parameter error ')); Die } $requireUrl = ' http://www.ihxlife.com/sms/smsCode_Send ';//request Address $postData = ' mobile= '. I (' Post.mobile '). ' &busitype=10019&effectivetime=180 '; $cookieVerify = App_cookie. "/" . I (' Post.key '). ". tmp"; echo $cookieVerify. "
"; $referer = ' http://www.ihxlife.com/forget/forgetPwd '; echo $this->curlpost ($REQUIREURL, $postData, $cookieVerify, $referer, 30,true);}
Public Function GetCookie ($url, $cookieVerify) {echo $cookieVerify.
"; $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, Curlopt_useragent, ' mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) gecko/20100101 firefox/40.0 '); curl_setopt ($ch, Curlopt_ssl_verifypeer, 0); curl_setopt ($ch, Curlopt_header, 0); curl_setopt ($ch, Curlopt_httpheader, Array (' accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8 ', ' accept-encoding:gzip, deflate ', ' accept-language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3 ', ' Connection:keep-al Ive ', ' Host:www.ihxlife.com ')); curl_setopt ($ch, Curlopt_timeout, 120); Set timeout limit to prevent dead loops curl_setopt ($ch, Curlopt_returntransfer, true); curl_setopt ($ch, Curlopt_cookiejar, $cookieVerify); Curl_exec ($ch); Curl_close ($ch); Public Function Curlpost ($url, $post _fields, $cookieVerify, $referer = ", $timeOut = +, $header =") {$cur L = Curl_init (); curl_setopt ($curl, Curlopt_url, $url); curl_setopt ($curl, CUrlopt_ssl_verifypeer, 0); curl_setopt ($curl, Curlopt_ssl_verifyhost, 1); curl_setopt ($curl, Curlopt_useragent, ' mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) gecko/20100101 firefox/40.0 '); curl_setopt ($curl, curlopt_followlocation, 1); if ($referer) {curl_setopt ($curl, Curlopt_referer, $referer); } else {curl_setopt ($curl, Curlopt_autoreferer, 1); } if ($header) {//curl_setopt ($curl, Curlopt_httpheader, Array (' Host:www.ihxlife.com ', ' X-requested-with:xmlhtt Prequest ')); curl_setopt ($curl, Curlopt_httpheader, Array (' Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q =0.8 ', ' accept-encoding:gzip, deflate ', ' accept-language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3 ', ' content-type:application/x-www-form-urlencoded; Charset=utf-8 ', ' connection:keep-alive ', ' Host:www.ihxlife.com ', ' X-requested-with:xmlhtt Prequest ')); } curl_setopt ($curl, CURLOPT_POSTFIelds, $post _fields); curl_setopt ($curl, Curlopt_post, 1); curl_setopt ($curl, Curlopt_cookiefile, $cookieVerify); curl_setopt ($curl, Curlopt_cookiejar, $cookieVerify); curl_setopt ($curl, Curlopt_timeout, $timeOut); curl_setopt ($curl, Curlopt_header, 0); curl_setopt ($curl, Curlopt_returntransfer, 1); $resultData = curl_exec ($curl); Perform operation Curl_close ($curl); return $resultData;}

The problem is solved. This site updates the cookie when it loads the verification code for the home login module. My previous thinking has been to load the page to load the page and then did not notice here as long as the next page to access the verification code to save the updated verification code just fine!

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