---------------------------------------------------------------------------------------------------- Source for toc feed (html and javascript) TOC Service :: Google Ajax Feed API
Loading...
---------------------------------------------------------------------------------------------------- Source for mobile feed (html and javascript) Mobile Feed View: Google Ajax Feed API

« Back to Library

Google Ajax Feeds

The last 10 items on the MSU Library blog. View the source to see how this was done.

---------------------------------------------------------------------------------------------------- Source for json-template Google Feed API (HTML and PHP)
$feed, 'v' => '1.0', // API version //'v' => '2.0', // API version //'num' => 10, // maximum entries (limited) 'num' => -1, // maximum entries (limited) //'output' => 'json_xml', // mixed content: JSON for feed, XML for full entries (json|xml|json_xml) 'scoring' => 'h', // include historical entries ); //echo $base.http_build_query($params); //build request, encode entities (using http_build_query), and send to google feed api $request = file_get_contents($base.http_build_query($params)); if ($request === FALSE) { //API call failed, display message to user echo '

It looks like we can\'t communicate with the API at the moment.

'."\n"; exit(); } //create json object(s) out of response from google ajax feed api $json = json_decode($request); //define where to start grabbing data - in this case we start inside the first json element returned "responseData" $data = $json->responseData; //parse json elements and display as html echo '

'.$data->feed->title.'

'."\n"; echo '
'; foreach ($data->feed->entries as $entry) { echo '
'.$entry->title.'
'."\n"; echo '
'.$entry->publishedDate.'
'."\n"; echo '
'.$entry->author.'
'."\n"; //echo '
'.$entry->content.'
'."\n"; } echo '
'."\n"; ?>