in ,

Creating a social share Counter in PHP


Few days back, I was working on PHP script to count the number of times a URL was shared on different social network. So, I thought to share it with you all. In this script, you only need to enter the URL and it will show you the share count in Twitter, Facebook, Linkedin, Google+, Stumbleupon, Pinterest, delicious and buffer. Of course you can add more if you want.

But I tried basically only for these social websites. Approach was pretty simple. All websites offers their APIs to count these things. I only used those share counter


If you have ever worked with APIs, you can easily understand how the things are working. For example, I created this function for Twitter.

The above function will return the count of tweets a URL got on Twitter.

A similar kind of code for linkedin

The above function will fetch the LinkedIn share cont.

This function is for counting Facebook share.

You can download the full working code here


Please share this tutorial with your friends and help us.



Written by Deepanker

Deepanker Verma is the founder of Techlomedia. He is a tech blogger, developer and gadget freak.

Leave a Reply

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


How to block all ads on any website in Chrome

Increase Wordpress website traffic

How to get more organic traffic to your blog