This script will get number of shares of a post url from usual social networks and return the information as JSON.
Social networks
Currently:
- Facebook’s likes and shares
- LinkedIn’s shares
- Google plus’ shares
Usage
(You are free to put it anywhere you want if you know how to access it by url, of course.)
- Drop the file
getShares.php
in your wordpress main directory, next to wp-config.php file. - Call the file by url, per example: http://yoursite.com/getShares.php
Parameters
By default, the script return the last seven days posts, sorted by date of publication (by wordpress) and displayed in a table.
You can override this with parameters:
example: http://yoursite.com/getShares.php?days=1&sort=most&view=json
The script will return posts from the last day, sorted by shares count and in JSON format.
The link
https://gist.github.com/Cog-g/8284663
Todo
- Add a parameter to get result for only one specific url.