2012-05-21 95 views
0

我有我的域的谷歌應用程序帳戶。谷歌應用程序文檔說,要使用Gmail的Atom,你必須已經有一個聚合器。我使用php simplepie解析rss和atom feed在我的應用程序。 Google文檔說URL是https://mail.google.com/mail/feed/atom,然後輸入您的Gmail地址和密碼。如何使用php訪問Gmail收件箱提要

我可以使用設置網址設置網址。我似乎無法弄清楚,如何添加用戶名和密碼。我感謝任何幫助。由於

更新: -

我的一個朋友說,這部作品在蟒蛇。

import urllib2 

def get_unread_msgs(user, passwd): 
    auth_handler = urllib2.HTTPBasicAuthHandler() 
    auth_handler.add_password(
     realm='New mail feed', 
     uri='https://mail.google.com', 
     user='%[email protected]' % user, 
     passwd=passwd 
    ) 
    opener = urllib2.build_opener(auth_handler) 
    urllib2.install_opener(opener) 
    feed = urllib2.urlopen('https://mail.google.com/mail/feed/atom') 
    return feed.read() 

我不知道python。我很感激任何能夠幫助我理解如何在php中實現類似的東西的人。

我感謝你的幫助。

+0

請參閱此相關的問題(和答案): [是否有可能使用身份驗證的RSS使用PHP飼料?] [1] [1]:http://stackoverflow.com/questions/920003/IS-IT-可能使用的認證功能於RSS源,使用的PHP%圖20是%20IT%20to 20possible%%20use%20authentication%20英寸%20RSS%20feeds%20using%20php? – Roberto

回答

0

使用CURL與CURLOPT_USERPWD選項並獲取提到的URL的內容。

curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);

此只給了我未讀郵件,但。