Jump to content

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 = 'user@yahoo.com';
$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);
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.