ionicle Posted September 4, 2013 Share Posted September 4, 2013 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/mailxxxxx - username yyyyy - passwordEasy, 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? Quote Link to comment Share on other sites More sharing options...
.josh Posted September 4, 2013 Share Posted September 4, 2013 any particular reason why you are trying to use cURL to access your yahoo mail, instead of using IMAP or POP3 ? Quote Link to comment Share on other sites More sharing options...
.josh Posted September 4, 2013 Share Posted September 4, 2013 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.