Social Follower Count using PHP

This post will help you to find snippets to get followers count for social platforms like Facebook, Twitter, Google plus,  Youtube, Instagram, Pinterest  and Tumblr.

Facebook Followers Count
$FBFollowercount = 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;

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

Google Plus Followers Count
/ 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'];

Youtube Subscribers
$channel_name = 'Your Channel';
$data = file_get_contents("http://gdata.youtube.com/feeds/api/users/$channel_name?alt=json");
$data = json_decode($data, true);
$subscribersDetails = $data['entry']['yt$statistics'];
echo $subscribersDetails['subscriberCount'].'<br />';
echo $subscribersDetails['viewCount'].'<br />';

Instagram Followers
Register the app you will get an API Key and secret.
$api_key = 'API_KEY';
$user_id = 'UID';
$data = @file_get_contents("https://api.instagram.com/v1/users/$user_id/?client_id=$api_key");
$data = json_decode($data, true);
echo '<pre/>';
print_r($data);
echo $data['data']['counts']['followed_by'];

Pinterest Followers Count
$metas = get_meta_tags('http://pinterest.com/YOUR PINTREST ACCOUNT NAME/');
print_r($metas['pinterestapp:followers']);

Tumblr Likes
Login to Tumblr -> Setting Menu -> APP ->Register your APP get the API Key and secret key.
$api_key = 'API_KEY';
$blog_name = 'Blog_name';
$data = @file_get_contents("http://api.tumblr.com/v2/blog/$blog_name/info?api_key=$api_key");
$data = json_decode($data, true);
echo '<pre/>';
print_r($data);
echo $data['response']['blog']['likes'];


10 comments :

  1. where we can get Api key from Instagram?

    ReplyDelete
    Replies
    1. 1) Sign in Instagram as a developer
      https://www.instagram.com/developer/

      2) Register a new Client ID. fill all required details.

      3) Get Instagram Access Token using Client ID and Client Secret.

      Delete
  2. Thanks for providing recent updates regarding the concern, I look forward to read more.
    Instagram Follow

    ReplyDelete
  3. The biggest problem I used to face in maintaining my Twitter account was my irregularity in tweets. I started searching for an automation tool, and then I discovered WizUgo [com]. Wizugo is the right tool for those who are unable to give time to their Twitter account. All it needs is a five-minute setup, and you are free to go, Wizugo will take care of the rest.

    ReplyDelete
  4. Great post full of useful tips! My site is fairly new and I am also having a hard time getting my readers to leave comments. Analytics shows they are coming to the site but I have a feeling “nobody wants to be first”.
    ปั้มไลค์ฟรี

    ReplyDelete
  5. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
    คาสิโนออนไลน์ที่ดีที่สุด

    ReplyDelete
  6. his is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the excellent work.
    dmt vape pen for sale online

    ReplyDelete
  7. I read this article. I think You put a lot of effort to create this article. I appreciate your work.
    cheap webtraffic

    ReplyDelete
  8. I am reading this article rightnow. I think You put a lot of effort to create this article. I appreciate your work.


    Seoteach360 

    ReplyDelete
  9. As a seller of legal steroids, you can buy Crazy Bulk products, explore stacks and finally get the body you’ve always wanted زيادة مشاهدات فيديو يوتيوب

    ReplyDelete