The Google feeds API accomodates a wide range of scripting languages. You can view the See the other languages’ examples documentation here.
Quick and Easy RSS Feed Import
Simply enter the 2 URLS- your page and the page of the feed.
$referer = "http://your-site-here.com/"; // your website, of course! $feedurl = "http://solidlystated.com/feed"; // the feed location! $ip = $_SERVER['REMOTE_ADDR']; $apiurl = "https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=$feedurl&userip=$ip; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $apiurl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_REFERER, $referer); $body = curl_exec($ch); curl_close($ch); $results = json_decode($body);
All PHP calls to the Google API must follow the rules! Refer to Google’s notes on the API
Applications MUST always include a valid and accurate HTTP referer header in their requests.
We highly encourage you to include the userip parameter (not required, but highly encouraged). This parameter supplies the IP address of the end-user who made the request and validates that you are not making automated requests in violation of the Terms of Service.
$results is a PHP object containing the following information:
[responseData] => stdClass Object ( [feed] => stdClass Object ( [feedUrl] => http://solidlystated.com/feed [title] => SolidlyStated.com [link] => http://solidlystated.com [author] => [description] => Hardware. Software. Solid. [type] => rss20 [entries] => Array (  => stdClass Object ( [title] => iPhone/iPod Touch Add Photo or Video to Email [link] => http://solidlystated.com/hardware/iphone-add-photo-to-email/ [author] => SolidlyStated [publishedDate] => Sat, 29 Sep 2012 16:11:10 -0700 [contentSnippet] => Adding photo attachments to an email seem like such... [content] => <p>Adding photo attachments to an email seem like such...</p> <p>Last paragraph of content.</p> [categories] => Array (  => Hardware  => Apple  => email  => iPhone  => iPod Touch ) )  => stdClass Object ( ... more articles ... ) ) ) ) [responseDetails] => [responseStatus] => 200
The Results Object
Notice that you will get a “responseStatus” property in your $results variable. A good response will have a 200 status. You can easily avoid errors if it gives you a bad response using this check.
The $results object will contain multiple posts and you can use PHP to loop through and use what you want.
categories property will contain both the actual blog category and the post tags as well. This makes the category less than helpful for display purposes.