doulian8742 2013-05-21 09:46
浏览 125

使用cURL php获取outlook消息

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

  • 写回答

1条回答 默认 最新

  • doudong1117 2013-05-21 09:48
    关注

    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

    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?