0

I have google app account for my domain. Google app documentation says To use Gmail with Atom, you must already have an aggregator. I use php simplepie to parse rss and atom feeds on my app. Google documentation says url is https://mail.google.com/mail/feed/atom, and enter your Gmail address and password.

I can set url using Set the feed URL. I cannot seem to figure out, how to add the username and password. I appreciate any help. Thanks

UPDATE:-

One of my friends said this works in 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()

I have no knowledge of python. I appreciate anybody who can help me understand how to implement something similar in php.

I appreciate all your help.

Josh Randall
  • 1,284
  • 4
  • 18
  • 31
  • See this related question (and answer): [Is it possible to use authentication in RSS feeds using php?][1] [1]: http://stackoverflow.com/questions/920003/is-it-possible-to-use-authentication-in-rss-feeds-using-php%20Is%20it%20possible%20to%20use%20authentication%20in%20RSS%20feeds%20using%20php? – Roberto May 21 '12 at 07:17

1 Answers1

0

Use CURL with the CURLOPT_USERPWD option and get the content of the mentioned URL.

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

This only gave me unread emails though.

dakdad
  • 2,947
  • 2
  • 22
  • 21