Creating a social share Counter in PHP

Best WordPress Hosting

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 things.social share counter

Demo

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

Download

Please share this tutorial with your friends and help us.

advertisement

About The Author

  • ADD YOUR COMMENT

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!