abemedia / sharecount Goto Github PK
View Code? Open in Web Editor NEWA PHP script to fetch the count of social shares, cache the results and output as JSON, JSONP or XML data.
License: GNU General Public License v2.0
A PHP script to fetch the count of social shares, cache the results and output as JSON, JSONP or XML data.
License: GNU General Public License v2.0
as far as i am seeing, the database credentials supplied in the config file are never used anywhere in the code - did i miss something?
Hey, Google+ shown the Wrong share counting 1 share count = shown 11 shares 2 shares - count as 22 shares
how to fix this?
I host this share count on Openshift
Facebook count is not working anymore.
Hey.
At 20 Nov 2015 Twitter no longer support API 1.0. This is new way to get it: https://dev.twitter.com/rest/reference/get/search/tweets
Fix it, please.
This is a great Library, For facebook it uses the Total Number of Shares, Likes, and Comments which is good for some things.....
For my purposes however I need the total count AND the numbers separated. For example if I send the URL:
http://nba.com/warriors/gameday/20160522/recap
To your Script at: https://count.donreach.com/?url=http://nba.com/warriors/gameday/20160522/recap
it Returns:
{
"url": "http://nba.com/warriors/gameday/20160522/recap",
"total": 16797,
"shares": {
"facebook": 16797,
"google": 0,
"linkedin": 0,
"pinterest": 0
}
}
If we send it Directly to the Facebook API Graph at: https://api.facebook.com/method/links.getStats?format=json&urls=http://nba.com/warriors/gameday/20160522/recap
we get:
[{"url":"http:\/\/nba.com\/warriors\/gameday\/20160522\/recap","normalized_url":"http:\/\/www.nba.com\/warriors\/gameday\/20160522\/recap","share_count":117,"like_count":15815,"comment_count":865,"total_count":16797,"click_count":0,"comments_fbid":"991016050996638","commentsbox_count":11}]
Your script Returns only the "total_count". Could the script be changed to return at least for Facebook all the important additional parameters like shares separated from likes and comments like so:
{
"url": "http://nba.com/warriors/gameday/20160522/recap",
"total": 16797,
"shares": {
"facebook": {
"total_count":16797,
"commentsbox_count":11,
"click_count":0,
"comment_count":865,
"like_count":15815,
"share_count":117
},
"google": 0,
"linkedin": 0,
"pinterest": 0
}
}
What changes would be needed to do this?
API function to count shares and store to mysql
Is there a simple known method of using this script in a loop, so that a blog index page populated with post excerpts could also include the count?
Ta
I uploaded a fresh copy on my server and only un-commented the following 2 lines in index.php
$shares = $count->get('http://abemedia.co.uk');
print_r($shares);
And all it keeps showing is - Error: No URL specified.
Is there a WordPress plugin using this code? That can place it in a sidebar widget.
If not and I was to create one would there be any issues with that?
Plus it possible to wildcard a website and bring back the top 10?
$count = new shareCount;
$count->url = 'http://www.abc.com/';
$obj = json_decode($count->get());
$totalSocialShares = $obj->shares->total; //total social shares
this code when run, echo's my whole pages source code.
public $format = 'json'; // 'json', 'jsonp' or 'xml'
how to get it to just return the json of the shares?
i did this for a fix, not sure its the right way.
i added
case "html":
$this->format = 'html';
//header ("Content-Type:text/xml");
break;
to the setFormat() function
and in my config.php
public $format = 'html'; // 'json', 'jsonp' or 'xml'
require("share_count.php");
$count = new shareCount;
echo $count->get();
this gives me
Error: No URL specified.
Implement OAuth for reddit API due to new API limitations.
Is it possible to add YouTube Channel count as well ?
Can it be updated to get all pages on a domain as a example
I have 8 pages that I share that I would like to get the combined share total
var shareUrl = 'http://carrsdigital.net/';
var shareUrl = 'http://carrsdigital.net/Dare2BeNaughty/';
var shareUrl = 'http://carrsdigital.net/Dare2BeNaughtyBoudoir'
var shareUrl = 'http://carrsdigital.net/DesignerArtBooks/OohLaLa/';
var shareUrl = 'http://carrsdigital.net/DesignerArtBooks/StylusMag/';;
var shareUrl = 'http://carrsdigital.net/DesignerArtBooks/Casablanca/';
var shareUrl = 'http://carrsdigital.net/DesignerArtBooks/WhatIsSexxy';
var shareUrl = 'http://carrsdigital.net/DesignerArtBooks/Leather&Lace';
Can you please help with this?
Thank you
Create new API function 'share' which deletes cache then forwards to relevant share url.
I'm not able to save in DB, my config is:
<?php
class Config {
/* global cache settings */
public $cache = ''; // 'memcache', 'apc' or 'file' - leave blank to disable caching
public $cache_time = 86400; // in seconds e.g. 86400 = 24h
/* memcache settings - only required if cache set to memcache */
public $cache_server = 'localhost';
public $cache_port = 11211;
public $cache_persistent = true;
/* filecache settings - only required if cache set to file */
public $cache_directory = './cache/'; // needs trailing slash!
/* database settings - only required to track shares */
public $db_type = 'mysql';
public $db_host = 'localhost';
public $db_name = MYDBNAME;
public $db_user = MYUSER;
public $db_pass = MYPASS;
/* default output settings - ignored if url parameter has been passed */
public $format = 'json'; // 'json', 'jsonp' or 'xml'
public $callback = 'processShares'; // default jsonp callback function name
}
I make test of conection in my DB, with my data, and is all correct, but I'm not able to save shareds in DB, any help?
Hi,
First of thank you so much for open sourcing such precious scripts and letting everyone to use it for free. This surely requires a big heart. =)
I tried uploading the plugin scripts and files on a sub-domain located at http://count.mybloggertricks.com/
I also created a separate Mysql database and changed the config.php values to
/* database settings - only required to track shares */
public $db_type = 'mysql';
public $db_host = 'localhost';
public $db_name = 'mustafa_shares';
public $db_user = 'mustafa_shares';
public $db_pass = 'mypass';
But I am getting the following error on visiting the URL.
Parse error: syntax error, unexpected ':' in /home1/mustafa/public_html/count/share_count.php on line 37
There looks to be some syntax errors in the share_count.php file.
Am I doing something wrong. Would appreciate the slightest of help here.
Reddit no longer returns a share count value.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.