I need to connect my php script to Gmail Atom feed to retrieve the count of unread
messages, but I have problem on get the xml feed file:
if($xmlGmailFeed = simplexml_load_file("https://USERNAME:PASSWORD@gmail.google.com/gmail/feed/atom/"))
$unreadMessages = $xmlGmailFeed->fullcount;
gives: failed to load external entity
ho can I do? thaks 🙂
error! failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized
Yeah, sounds like a authentication error. I believe you have to authenticate using curl, as
simplexml_load_filedon’t suffice. Take a look at the GmAtom class. It will do the trick, or at least point you in the right direction.