The Facebook, Twitter and Google plus data are available publicly in Json format, we can use some information to easily display number of likes, followers and circle counts in plain text. I wanted to include Feedburner Subscriber count code too, but too bad Google has decided to put an end to Awareness API, without it we can not display subscriber count in plain text.
The URLs in box below are three magic URLs from these top sites, which contains information about people and pages in JSON format.
If you execute these URLs in browser address bar with correct variables, it should return some data about respective page or person. For example, this Facebook graph URL https://graph.facebook.com/saarraan returns information about saaraan’s Facebook Page.
Notice the likes property of the Json object? similarly Twitter has followers_count,
and Google Plus has plusOneCount property. All we need is a mechanism to retrieve these values and use it in our projects. For that I have created a small PHP function which uses cURL or file_get_contents to fetch the data, it will then decode and parse JSON data in PHP objects, which we will use to display counts in our pages.
Have a look at complete code below:
Twitter Followers : 1525
Facebook Fans : 1100
Google Page Circle : 19