How-To Parse RSS Feeds With Google's Feed API


How-To Parse RSS Feeds With Google’s Feed API

Tired of processing RSS/Atom feeds in your app? Today Google announced their new Google AJAX Feed API that will do the parsing (and caching!) for you. It works great for Javascript developers, but what if you want to use a server side language like PHP? Here’s a quick (and totally unauthorized) hint to let you do so.

Digging through Google’s Javascript code, we find that they make a request to the Google mothership to parse a feed using this url:

In theory, just insert a link to the feed you want parsed into their url and voila! Sort of.

The feed data is returned inside a Javascript object. Before we can use it we need to extract the real data and convert JSON’s escaped unicode characters into their HTML equivalents.


    $url = urlencode("");

    $data = file_get_contents("

    preg_match('/{(.*?)}/', $data, $matches);

    $data = json_decode($matches[0])->xmlString;


And with that, we’re done! You can throw any type of feed at Google’s parser and you’ll get back the data as a well-formed Atom feed. Throw in a little SimpleXML and you’re all set.

Comments are closed on this post