0

I want connect to Outlook.com using cURL (php) and get the message from inbox.

<?php
        $url = "https://login.live.com/login.srf?wa=wsignin1.0&ct=1369129355&rver=6.1.6206.0&sa=1&ntprob=-1&wp=MBI_SSL_SHARED&wreply=https:%2F%2Fmail.live.com%2F%3Fowa%3D1%26owasuffix%3Dowa%252f&id=64855&snsc=1&cbcxt=mail"; 
        $post_fields ="email=xxxx@outlook.com&pass=xxxx"; 

        $cookie_path = "\hotmail_login\cook";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url); 
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_path); 
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_path); 
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
        $output = curl_exec ($ch); 
        echo $output; 
    ?>

Any suggestions? Thanks in advance

Tim Lehner
  • 14,813
  • 4
  • 59
  • 76
Chahroud
  • 31
  • 1
  • 6

1 Answers1

0

To connect with mail sever you should use POP3 or IMAP, there is no point in using curl for this.

http://php.net/manual/en/function.imap-open.php

here you have examples of how to connect with IMAP using PHP and get messages

Robert
  • 19,800
  • 5
  • 55
  • 85
  • thnx Robert, I already use imap with outlook but it takes a lot of time, I want connect with cURL to scrap the inbox for processing speed :( – Chahroud May 21 '13 at 09:54
  • so maybe you should provide more information to curl, to look more like "human opening browser" than curl. For use browser name in curl. – Robert May 21 '13 at 10:40
  • look the difference : outlook : Total Execution Time: 250.8 seg. (967 msg) gmail : Total Execution Time: 19.8 seg. (3500 msg ) – Chahroud May 21 '13 at 11:09