Jump to content

Automated Yahoo Mail login with cURL - how?


ionicle

Recommended Posts

I am currently attempting to create a page with cURL instructions that does the following:

Take the following link, send a GET request to it, and retrieve the results.

http://login.yahoo.com/config/login?login=xxxxxxx&passwd=yyyyyyyy&.done=http://m.yahoo.com/mail

xxxxx - username yyyyy - password

Easy, right? Not really. Since the page that is to be returned, is designed to automatically log you in your Yahoo Mail inbox.

I tried with:

 

 

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_AUTOREFERER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_URL => 'http://login.yahoo.com/config/login?login=xxxxxx&passwd=yyyyyyy&.done=http://m.yahoo.com/mail',
CURLOPT_USERAGENT => 'something-here'
));


$resp = curl_exec($curl);

curl_close($curl);

echo $resp;

?>
 

I do get a response, but all it's about is the Yahoo Mail login page. It doesn't actually execute the login and retrieve the related Yahoo inbox.

How would I go about doing that with cURL?

simple script showing the basics of IMAP with yahoo (use your own username/password):

 

/* connect to yahoo */
$hostname = '{imap.mail.yahoo.com:993/imap/ssl}INBOX';
$username = '[email protected]';
$password = 'password';

/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to yahoo: ' . imap_last_error());

/* grab emails */
$emails = imap_search($inbox,'ALL');

/* if emails are returned, cycle through each... */
if($emails) {
	
  /* put the newest emails on top */
  rsort($emails);
	
  /* gonna just output some basic info in table format */
  echo "<table>";
  echo "<tr align='left'>";
  echo "<th>FROM</th>";
  echo "<th>DATE</th>";
  echo "<th>SUBJECT</th>";
  echo "</tr>";

  /* for every email... */
  foreach($emails as $email_number) {
		
    /* get information specific to this email */
    $overview = imap_fetch_overview($inbox,$email_number,0);
		
    /* echo basic info about it */
    echo "<tr>";
    echo "<td>".$overview[0]->from."</td>";
    echo "<td>".$overview[0]->date."</td>";
    echo "<td>".$overview[0]->subject."</td>";
    echo "</tr>";
		
  }

  echo "</table>";	

} 

/* close the connection */
imap_close($inbox);

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.