【发布时间】:2012-05-21 06:20:40
【问题描述】:
我的域有 Google 应用帐户。谷歌应用程序文档说要将 Gmail 与 Atom 一起使用,您必须已经有一个聚合器。我使用 php simplepie 在我的应用程序上解析 rss 和 atom 提要。谷歌文档说 url 是 https://mail.google.com/mail/feed/atom,然后输入你的 Gmail 地址和密码。
我可以使用设置提要 URL 来设置 url。我似乎无法弄清楚如何添加用户名和密码。我很感激任何帮助。谢谢
更新:-
我的一个朋友说这在 python 中有效。
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='%s@gmail.com' % 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 中实现类似功能的人。
感谢您的帮助。
【问题讨论】:
-
查看相关问题(和答案):[Is it possible to use authentication in RSS feeds using php?][1] [1]: stackoverflow.com/questions/920003/…?
标签: php python cakephp gmail-imap simplepie