Pulling data from Google Plus streams with PHP and displaying with jQuery

The following block below pulls data from the Google API for Google+ via PHP, stores the data in cache file (which is checked on an interval of 10 minutes), and then is muxed with jQuery ajax converter to inject into a jsRender template.

Things to note:

  1. You don't have to use jsRender (it's overkill for this simple example, but I was previsouly testing something else so I left it).
  2. Similarly, you don't have to use the ajax converter (you could very well do that server side or change the API call query). Again, I was testing something else, so it stuck around.
  3. The Google API for Google+ has a courtesy limit of 1,000 queries per day, hence the json cache file.
  4. You could very well write the exact same cache script in Node.js, Ruby, Python, Perl, whatever. There's nothing inherently special about the PHP.
  5. The API query really only looks for type "article" for shared links; you can pretty much pull back anything you want. I just used this as a simple example case.
  6. Right now, it's pulling from Justin Ribeiro's G+ profile.

More information about this demo: see blog post.

The PHP

The jQuery AJAX call w/converter