Phpcurl simulates the problem Code of logging on to login.yahoo.co.jp. but the code for entering the verification code is as follows: privatefunctionlogin () {& nbsp; $ is_login0; & nbsp; $ rurl & quot; www.yahoo.co.jp & q php curl simulated login https://login.yahoo.co.jp problems
I basically wrote the code, but the captured page allows you to enter the verification code.
The code is as follows:
Private function login (){
$ Is_login = 0;
$ Rurl = "http://www.yahoo.co.jp ";
// Obtain the random code
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, "https://login.yahoo.co.jp/config/login ");
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ this-> cookie_jar );
Curl_setopt ($ ch, CURLOPT_HEADER, 1 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false );
$ Tmp = curl_exec ($ ch );
// Curl_close ($ ch );
Preg_match ('/ /I ', $ tmp, $ mchallenge );
Preg_match ('/ /I ', $ tmp, $ mu );
Preg_match ('/ /Is ', $ tmp, $ malbatross );
$ Challenge = $ mchallenge [1];
$ U = $ mu [1];
$ Albatross = $ malbatross [1];
// Print_r ($ cookie_jar); exit;
// Print_r ($ arr); exit;
// $ Hash_passwd = md5 (md5 ($ this-> user_pwd). $ challenge );
// Step 1: initial login
// $ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, "https://login.yahoo.co.jp/config/login ");
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS ,". albatross = ". $ albatross. "&. ct = ". "&. tries = 1 &. src = &. md5 = &. hash &. js = &. last = & promo = &. intl = jp &. bypass = &. partner = &. u = ". $ u. "&. v = 0 &. challenge = ". $ challenge. "&. yplus = &. emailCode = & pkg = & stepid = &. ev = & hasMsgr = 0 &. chkP = Y &. done = ". $ rurl. "&. pd = &. protoctl = & login = ". $ this-> username. "& passwd = ". $ this-> password );//
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ this-> cookie_jar );
Curl_setopt ($ ch, CURLOPT_HEADER, 1 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false );
$ Str = curl_exec ($ ch );
Curl_close ($ ch );
Echo $ str; exit;
// Determine whether the logon is successful
If (strpos ($ str, "HTTP/1.1 302 Found ")! = False ){
$ Is_login = 1;
}
Return $ is_login;
}
Both the user name and password are available, but the verification code is entered after simulated logon, which is depressing,
The heroes of soso can help solve the problem,
The source code name = ". albatross" in the https://login.yahoo.co.jp/has something to do with the login, every time the page is refreshed, it will change, so I guess it is related,
------ Solution --------------------
It seems that it is not successful ~~
------ Solution --------------------
Unless someone has done something else, you may not be able to get the answer here.
------ Solution --------------------
Enter the verification code
No solution.