The curl simulated password retrieval error is incomprehensible.

Source: Internet
Author: User
Tags ukey
Curl simulates password retrieval (Huaxia insurance) to directly retrieve the password page www. ihxlife. comforget... if you enter the mobile phone number 15677748704 (test) to obtain the verification code, the system will prompt that the verification code is incorrect. However, after entering the official website, the system will go to the official website link to access the page to obtain the verification code...

Curl simulated retrieval password (Huaxia insurance) direct retrieval password page http://www.ihxlife.com/forget...
If you enter the mobile phone number 15677748704 (test) to obtain the verification code, an error message is displayed.

However, after entering the official website, you can access the page through the link to obtain the verification code.

Use the code to first access the home page to obtain the cookie and then use the obtained cookie to access the retrieval password page to update the cookie.
Then obtain the verification code ------ failed SMS verification code failed to be sent

Public function forgetPwdIndex () {$ uKey = 'Huaxia '. date ("YmdHis "). uniqid (); $ cookieVerify = APP_COOKIE. "/". $ uKey. ". tmp "; $ url =' http://www.ihxlife.com/ '; // Log on to the homepage url to obtain the cookie $ this-> getCookie ($ url, $ cookieVerify ); // Obtain the cookie on the logon page // Obtain the cookie on the password retrieval 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); // sets the timeout limit to prevent endless loops curl_setopt ($ ch, timeout, 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 = 100', '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); // post the cookie file of this data set on the page to the page $ this-> display ();} public function sendPwdMobileCode () {if (I ('post. key ') = ''| I ('post. mobile ') = '') {echo json_encode (array ('status' => '000000', '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, expires, 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 = 100', 'Accept-Encoding: gzip, deflate ', 'Accept-Language: zh-CN, zh; q = 0.8, en-US; q = 0.5, en; q = 100', 'connection: keep-alive ', 'host: www.ihxlife.com'); curl_setopt ($ ch, CURLOPT_TIMEOUT, 120); // set timeout limit to prevent endless 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 = 30, $ header ='') {$ curl = curl_init (); curl_setopt ($ curl, CURLOPT_URL, $ url ); curl_setopt ($ curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($ curl, expires, 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: XMLHttpRequest'); 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: XMLHttpRequest');} curl_setopt ($ curl, CURLOPT_POSTFIELDS, $ post_fields ); curl_setopt ($ curl, CURLOPT_POST, 1); curl_setopt ($ curl, scheme, $ cookieVerify); curl_setopt ($ curl, scheme, $ cookieVerify); curl_setopt ($ curl, CURLOPT_TIMEOUT, $ timeOut); curl_setopt ($ curl, CURLOPT_HEADER, 0); curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1); $ resultData = curl_exec ($ curl ); // execute curl_close ($ curl); return $ resultData ;}

Reply content:

Curl simulated retrieval password (Huaxia insurance) direct retrieval password page http://www.ihxlife.com/forget...
If you enter the mobile phone number 15677748704 (test) to obtain the verification code, an error message is displayed.

However, after entering the official website, you can access the page through the link to obtain the verification code.

Use the code to first access the home page to obtain the cookie and then use the obtained cookie to access the retrieval password page to update the cookie.
Then obtain the verification code ------ failed SMS verification code failed to be sent

Public function forgetPwdIndex () {$ uKey = 'Huaxia '. date ("YmdHis "). uniqid (); $ cookieVerify = APP_COOKIE. "/". $ uKey. ". tmp "; $ url =' http://www.ihxlife.com/ '; // Log on to the homepage url to obtain the cookie $ this-> getCookie ($ url, $ cookieVerify ); // Obtain the cookie on the logon page // Obtain the cookie on the password retrieval 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); // sets the timeout limit to prevent endless loops curl_setopt ($ ch, timeout, 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 = 100', '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); // post the cookie file of this data set on the page to the page $ this-> display ();} public function sendPwdMobileCode () {if (I ('post. key ') = ''| I ('post. mobile ') = '') {echo json_encode (array ('status' => '000000', '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, expires, 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 = 100', 'Accept-Encoding: gzip, deflate ', 'Accept-Language: zh-CN, zh; q = 0.8, en-US; q = 0.5, en; q = 100', 'connection: keep-alive ', 'host: www.ihxlife.com'); curl_setopt ($ ch, CURLOPT_TIMEOUT, 120); // set timeout limit to prevent endless 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 = 30, $ header ='') {$ curl = curl_init (); curl_setopt ($ curl, CURLOPT_URL, $ url ); curl_setopt ($ curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($ curl, expires, 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: XMLHttpRequest'); 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: XMLHttpRequest');} curl_setopt ($ curl, CURLOPT_POSTFIELDS, $ post_fields ); curl_setopt ($ curl, CURLOPT_POST, 1); curl_setopt ($ curl, scheme, $ cookieVerify); curl_setopt ($ curl, scheme, $ cookieVerify); curl_setopt ($ curl, CURLOPT_TIMEOUT, $ timeOut); curl_setopt ($ curl, CURLOPT_HEADER, 0); curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1); $ resultData = curl_exec ($ curl ); // execute curl_close ($ curl); return $ resultData ;}

The problem is solved. This website updates the cookie when loading the verification code of the homepage logon module. I have been thinking about loading pages, loading pages, and I didn't notice that I only need to visit the verification code on the home page to save the updated verification code!

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.