Twitter FaceBook Gplus Pinterest followers count using PHP , In many cases we need such a solution using Oauth or CURL method. Here I will explain how we can get most used social media accounts followers count using basic PHP script.
First we can discuss about [label style=”4″] Twitter followers Count [/label]
We know that twitter API version 1.0 is no more available now API 1.1 is used so , we have to use the Oauth method. First you have to create Twitter APP and get the API key and secret key, Just follow my Post to twitter using PHP Oauth article. also download the library files from the post, After getting the keys try the following codes.
[code style=”1″]
require_once ‘twitteroauth.php’;
define(“CONSUMER_KEY”, “****consumer key*******”);
define(“CONSUMER_SECRET”, “*******Consumer secret********”);
define(“OAUTH_TOKEN”, “**********Oauth token*******”);
define(“OAUTH_SECRET”, “*****Oauth Secret********”);
$username = ‘Walkswithmenet’; //Your twitter screen name or page name
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
$followers = $connection->get(‘https://api.twitter.com/1.1/users/show.json?screen_name=’.$username);
echo ($followers->followers_count);
[/code]
[label style=”4″] Pinterest Followers Count [/label]
For reading your Pinterest account followers count simply use the following scripts.
[code style=”1″]
$metas = get_meta_tags(‘http://pinterest.com/YOUR PINTREST ACCOUNT NAME/’);
print_r($metas[‘pinterestapp:followers’]);
[/code]

[label style=”4″] FaceBook Followers Count [/label]
Just parse the return data from Facebook, its a JSON array
[code style=”1″]
$FBFollow = file_get_contents(‘http://api.facebook.com/method/fql.query?format=json&query=select+fan_count+from+page+where+page_id%3D355692061120689’);
$data = json_decode($FBFollow);
echo $data[0]->fan_count;
[/code]
[label style=”4″] Google Plus Followers Count [/label]
For reading your gplus account followers you have to create an APP with Google then you will get an access token, then simply apply with your page ID and access token to get the followers. Create a Google APP with Google console
[code style=”1″]
// get api https://code.google.com/apis/console?hl=en#access
$google_api_key = ‘YOUR_API’;
$page_id = ‘YOUR_PAGE_ID’;
$data = @file_get_contents(“https://www.googleapis.com/plus/v1/people/$page_id?key=$google_api_key”);
$data = json_decode($data, true);
echo $data[‘plusOneCount’];
[/code]
Hope this article will help you to get common social media followers count using PHP. including the Facebook Twitter Pinterest and Gplus accounts

Thank you very much for the snippets. I’ve been searching a lot for getting Pinterest followers number. So sad that there’s no official documents for this.