473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

cUrl yahoo login,mail verification problem.

i am new to curl .and i m trying to create create a script for my client to log into yahoo and click the confirmation 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=&.em ailCode=&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&pass wd=mypassword&.persistent=y&.save=&passwd_raw=


Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.  
  4.     $authUrl    = "https: //login.  yahoo  .   com/config/login?";
  5.     $userAgent  = "Mozilla/5.0 (Windows NT 5.1; rv:2.0b11) Gecko/20100101 Firefox/4.0b11";
  6.     $referer    = "http  :  //  my  .  yahoo  .  com";
  7.     $login      = "userid";
  8.     $password   = "password";
  9.     $numPostData = 22;
  10.     $cookieFileJar  = "ycookie.txt";
  11.     $cookie = 0;
  12.     $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=" ;
  13.  
  14.     $ch = curl_init();
  15.     curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
  16.  
  17.     // Set the referrer
  18.     curl_setopt($ch, CURLOPT_REFERER, $referer);
  19.  
  20.     // Set the authentication url
  21.     curl_setopt($ch, CURLOPT_URL, $authUrl);
  22.  
  23.     // Set number of post fields
  24.     curl_setopt($ch, CURLOPT_POST, $numPostData);
  25.  
  26.     //Set post data in key=value pair such as login=yourusername
  27.     curl_setopt($ch, CURLOPT_POSTFIELDS, $numPostData);
  28.  
  29.     //Set filename for storing cookie information
  30.     curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFileJar);
  31.  
  32.     //Set ffilename for checking the stored cookie information
  33.     curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFileJar);
  34.  
  35.     //Set option for cookie
  36.     curl_setopt($ch, CURLOPT_COOKIE, $cookie);
  37.  
  38.  //set this to output the result as string and not output directly ot browser
  39.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  40.  
  41.  //set this value to 1 if you want to redirect to the url you provided as service url
  42.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  43.  
  44.  //Set this option if you do not want to verify ssl
  45.     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  46.  
  47.  //set this option if you do not want to verify peer's certificate
  48.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  49.  
  50.  //now execute the curl
  51.     $res = curl_exec($ch);
  52.      echo $res;
  53.  //check if the username and password is valid
  54.     if ((preg_match("/invalid/i", $res)) || (preg_match("/not yet taken/i", $res))) {
  55.         echo "Invalid Login";
  56.     }
  57.     else {
  58.   //if  CURLOPT_FOLLOWLOCATION is set to 1 then after logging in successfully user is directed to url that is specified as service url
  59.         echo "Logged In";
  60.     }
  61. ?>

then i have to work for clicking confirmation links in mails. please suggest me some ways.i would be very grateful to you :)
Feb 12 '11 #1
1 2905
numberwhun
3,509 Expert Mod 2GB
A PHP question posted in the Perl forum. Next time, please post to the correct forum! I will move it this time.
Feb 12 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Lu | last post by:
Hi, I have a redhat 9 linux machine running apache 2.0.47, mysql 4.0.15, and php 4.3.4. I have been puzzled by this mail() problem for quite a while, could someone please give me some hint on...
2
by: bryce21 | last post by:
I'm trying to write a script that logs into Yahoo Fantasy Football. Once logged in, I'll be able to grab stats and various other pieces of info about our league. The problem I'm having deals with...
2
by: Corey | last post by:
I'm running Windows/Outlook XP with mail routed through POP3/SMTP university servers. Abruptly, I am no longer able to send mail, though receiving works fine. I get an error message saying that...
4
by: Patrick.O.Ige | last post by:
I have a code below.(It validates against a SQL DB(login page).thats is giving me an error! When i try to use :- Session = dr.ToString(); To catch the username so as to redirect the user logged in...
0
by: tma | last post by:
I am exporting a Crystal report to a .pdf. My problem is that when I attach the file to a message with the below code, the file attachment is truncated and will not open. As an aside, I'm using...
1
by: rxgmoral | last post by:
dll problem,help me:) i create dll project ,the dll is Use MFC in a Static Library i hope exe call ListCtrl class from dll ==================DLL====================...
0
by: sudipmondal440 | last post by:
import javax.mail.*; import javax.mail.internet.*; import java.util.*; import javax.activation.*; import javax.swing.text.*; import javax.swing.*; import java.io.*; import java.awt.*; ...
2
by: zamorac | last post by:
Ok, so i want to make a curl to go to a website, logon and do some stuff. Yeah i know its simple and so on, but it has a catch. The website has a hidden field with a random token, its a number with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.