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:
- 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).
- 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.
- The Google API for Google+ has a courtesy limit of 1,000 queries per day, hence the json cache file.
- 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.
- 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.
- Right now, it's pulling from Justin Ribeiro's G+ profile.
More information about this demo: see blog post.