2013-05-21 247 views
0

我想使用cURL(php)連接到Outlook.com並從收件箱中獲取郵件。使用cURL獲取outlook郵件php

<?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 protected]&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; 
    ?> 

有什麼建議嗎? 在此先感謝

+0

你爲什麼不使用IMAP的例子嗎? – Robert

回答

0

要與郵件服務器連接,您應該使用POP3或IMAP,沒有用curl這一點。

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

在這裏你有一個如何使用IMAP使用PHP連接和獲取消息

+0

thnx羅伯特,我已經使用IMAP與Outlook,但它需要很多時間,我想用cURL連接來取消處理速度的收件箱:( – Chahroud

+0

因此,也許你應該提供更多的信息來捲曲,看起來更像是「人類開放瀏覽器「比捲曲。使用瀏覽器名稱捲曲 – Robert

+0

看起來不同: 展望:總執行時間:250.8 seg。(967 msg) gmail:總執行時間:19.8 seg。(3500 msg) – Chahroud