Una función para obtener el número total de shares de las principales redes sociales («Delicious», «Google Plus», «Buzz», «Twitter», «Digg», «Pinterest», «LinkedIn», «StumbleUpon», «Reddit», «Facebook») de manera rápida y sencilla gracias a la API de sharedcount.com:
function num_total_shares($url) { $json = file_get_contents("http://api.sharedcount.com/?url=" .rawurlencode($url)); $num = json_decode($json, true); $total = 'Twitter: '. $num["Twitter"] .'<br>'; $total .= 'Facebook: '.$num["Facebook"]["total_count"] .'<br>'; $total .= 'Google+: '.$num["GooglePlusOne"]; // Etc... echo $total; } echo num_total_shares('https://www.bufa.es');
Agradezco tu comentario 🤘