Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems logging in to Yahoo using cURL in php
    primarykey
    data
    text
    <p>I am having problem logging in to Yahoo with the PHP code I have written. The code was working earlier, but for some reason it stopped working. It always shows Yahoo login page with my username at the top like, <code>Hi Sudhir</code> at the header as if I'm logged in already, along with my yahoo username, but displays password field and Login button again saying <code>Please Verify your password</code>. </p> <p>Though I tried to resend the request once more taking the new form action <code>https://login.yahoo.com/config/login_verify2?</code>, but it keeps on displaying the same page. Following is my complete Yahoo login code.</p> <p>Please suggest what am I doing wrong or am I missing something?</p> <pre><code>&lt;?php $yahooCalUrl = "http://calendar.yahoo.com"; $ch = curl_init($yahooCalUrl); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies_new.txt"); //curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies_new.txt"); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $resCalUrl = curl_exec($ch); //echo $resCalUrl; $loginUrl = "https://login.yahoo.com/config/login?"; //get the hidden values $searchStr = "/name=\".u\" value=\"(.*?)\"/"; preg_match($searchStr, $resCalUrl, $matches); $u = $matches[1]; $searchStr1 = "/name=\".challenge\" value=\"(.*?)\"/"; preg_match($searchStr1, $resCalUrl, $matches1); $challenge = $matches1[1]; $searchStr2 = "/name=\".pd\" value=\"(.*?)\"/"; preg_match($searchStr2, $resCalUrl, $matches2); $pd = $matches2[1]; $username = "my_yahoo_username"; $password = "my_yahoo_password"; //$mdPassword = md5($password); //$finalPass = $mdPassword . $challenge; //$hash = md5($finalPass); //$finalHash = urlencode($hash); $done = urlencode("http://calendar.yahoo.com"); $postFields = ".tries=1&amp;.src=fpctx&amp;.md5=&amp;.hash=&amp;.js=&amp;.last=&amp;promo=&amp;.intl=us&amp;.bypass=&amp;.partner=&amp;.u=".$u."&amp;.v=0&amp;.challenge=".$challenge."&amp;.yplus=&amp;.emailCode=&amp;pkg=&amp;stepid=&amp;.ev=&amp;hasMsgr=0&amp;.chkP=Y&amp;.done=http%3A%2F%2Fwww.yahoo.com%2F&amp;.pd=fpctx_ver%3D0%26c%3D%26ivt%3D%26sg%3D&amp;pad=3&amp;aad=3&amp;login=".$username."&amp;passwd=".$password."&amp;.save=&amp;passwd_raw="; //$postFields = ".tries=1&amp;.src=&amp;.md5=&amp;.hash=&amp;.js=&amp;.last=&amp;promo=&amp;.intl=us&amp;.bypass=&amp;.partner=&amp;.u=".$u."&amp;.v=0&amp;.challenge=".$challenge."&amp;.yplus=&amp;.emailCode=&amp;pkg=&amp;stepid=&amp;.ev=&amp;hasMsgr=1&amp;.chkP=Y&amp;.pd=".$pd."&amp;pad=6&amp;aad=6&amp;.persistent=&amp;.save=1&amp;login=".$username."&amp;passwd=".$password."&amp;.done=".$done; curl_setopt($ch, curlOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_URL, $loginUrl); curl_setopt($ch, CURLOPT_REFERER, $loginUrl); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies_new.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies_new.txt"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $finalLoggedIn = curl_exec($ch); echo $finalLoggedIn; ?&gt; </code></pre> <p>Though I tried using the password hash, i.e. combining the dynamic channel value of Yahoo with my password, but it didn't work out that way either.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload