Jump to content

stuck in php cURL yahoo login code: plz help here


lucky_che

Recommended Posts

i am new to curl .and i m trying to create create a script to log into yahoo and click the confermation link in emails.

but i am stuck witht he login process only

i made the code below . but still i cant make it work. the problem is yahoo is implementing a captcha challange for this kind of automated headers. do you have any idea ho to make it work again without alerting the captcha challange ?

 

the header i caught through the livehttp header is as follows:

 

Content-Length: 347

.tries=1&.src=ym&.md5=&.hash=&.js=&.last=&promo=&.intl=in&.bypass=&.partner=&.u=4ls6cr96lbs8e&.v=0&.challenge=W9w31pCrbdazCcY4mH41fVsyxwd8&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=0&.chkP=Y&.done=http%3A%2F%2Fmail.yahoo.com&.pd=ym_ver%3D0%26c%3D%26ivt%3D%26sg%3D&pad=1&aad=1&login=myyahooid&passwd=mypassword&.persistent=y&.save=&passwd_raw=

 

 

<?php

    
    $authUrl    = "https: //login.  yahoo  .   com/config/login?";
    $userAgent  = "Mozilla/5.0 (Windows NT 5.1; rv:2.0b11) Gecko/20100101 Firefox/4.0b11";
    $referer    = "http  :  //  my  .  yahoo  .  com";
    $login      = "userid";
    $password   = "password";
    $numPostData = 22;
    $cookieFileJar  = "ycookie.txt";
    $cookie = 0;
    $postData = ".tries=1&.src=ym&.md5=&.hash=&.js=&.last=&promo=&.intl=in&.bypass=&.partner=&.u=4ls6cr96lbs8e&.v=0&.challenge=W9w31pCrbdazCcY4mH41fVsyxwd8&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=0&.chkP=Y&.done=http%3A%2F%2Fmail.yahoo.com&.pd=ym_ver%3D0%26c%3D%26ivt%3D%26sg%3D&pad=1&aad=1&login=$login&passwd=$password&.persistent=y&.save=&passwd_raw=" ;

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);

    // Set the referrer
    curl_setopt($ch, CURLOPT_REFERER, $referer);

    // Set the authentication url
    curl_setopt($ch, CURLOPT_URL, $authUrl);

    // Set number of post fields
    curl_setopt($ch, CURLOPT_POST, $numPostData);

    //Set post data in key=value pair such as login=yourusername
    curl_setopt($ch, CURLOPT_POSTFIELDS, $numPostData);

    //Set filename for storing cookie information
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFileJar);

    //Set ffilename for checking the stored cookie information
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFileJar);

    //Set option for cookie
    curl_setopt($ch, CURLOPT_COOKIE, $cookie);

//set this to output the result as string and not output directly ot browser
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

//set this value to 1 if you want to redirect to the url you provided as service url
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);

//Set this option if you do not want to verify ssl
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

//set this option if you do not want to verify peer's certificate
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

//now execute the curl
    $res = curl_exec($ch);
     echo $res;
//check if the username and password is valid
    if ((preg_match("/invalid/i", $res)) || (preg_match("/not yet taken/i", $res))) {
        echo "Invalid Login";
    }
    else {
  //if  CURLOPT_FOLLOWLOCATION is set to 1 then after logging in successfully user is directed to url that is specified as service url
        echo "Logged In";
    }
?>

 

 

then i have to work for clicking confermation links in mails. please suggest me some ways.i would be very grateful to you :) 

Link to comment
Share on other sites

Auto click confirmation links? The point of that is to prevent spam.. The need for automation of this makes me think you're trying to mass sign up on sites to POST spam.

 

Other than that, are you looking for a way to beat [pass] the captcha or prevent it from showing up?

 

I think it's because the ".challenge" field changes every time, so when you use an outdated .challenge code, you get the captcha. If you can find a way to get a valid code so you can append it to the submitted post data instead of using an outdated one, you might be in luck?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.