【问题标题】:Getting outlook message using cURL php使用 cURL php 获取 Outlook 消息
【发布时间】:2013-05-21 09:46:35
【问题描述】:

我想使用 cURL (php) 连接到 Outlook.com 并从收件箱中获取邮件。

<?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; 
    ?>

有什么建议吗? 提前致谢

【问题讨论】:

  • 为什么不用imap?

标签: php curl outlook outlook.com


【解决方案1】:

要连接邮件服务器,您应该使用 POP3 或 IMAP,为此使用 curl 没有意义。

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

这里有如何使用 PHP 连接 IMAP 并获​​取消息的示例

【讨论】:

  • thnx Robert,我已经在 Outlook 中使用了 imap,但它需要很长时间,我想连接 cURL 以报废收件箱以提高处理速度:(
  • 所以也许你应该为 curl 提供更多信息,看起来更像是“人类打开浏览器”而不是 curl。在 curl 中使用浏览器名称。
  • 看看区别:展望:总执行时间:250.8 seg。 (967 msg) gmail:总执行时间:19.8 seg。 (3500 消息)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-09-16
  • 1970-01-01
  • 2012-06-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多