Main menu
WalkswithMeSocial NetworkingTwitter FaceBook Gplus Pinterest Followers Using PHP

Twitter FaceBook Gplus Pinterest Followers Using PHP

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  Twitter followers Count

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.


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);
  Pinterest Followers Count

For reading your Pinterest account followers count simply use the following scripts.


$metas = get_meta_tags('http://pinterest.com/YOUR PINTREST ACCOUNT NAME/');
print_r($metas['pinterestapp:followers']);
social media followers count

social media followers count

  FaceBook Followers Count

Just parse the return data from Facebook, its a JSON array


$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;
  Google Plus Followers Count

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


// 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'];

Hope this article will help you to get common social media followers count using PHP. including the Facebook Twitter Pinterest and Gplus accounts

One thought on “Twitter FaceBook Gplus Pinterest Followers Using PHP

Leave a Reply

Your email address will not be published. Required fields are marked *

 

FacebookTwitterGoogle+RSS