Este sitio web utiliza cookies para realizar análisis y mediciones de tus visitas. [ Acepto ] [ Más información aquí ].

How to Get Number of Tweets about a Website on Twitter

To get the total number of tweets about a website on Twitter, just use this PHP code. Replace www.yourwebsite.com with any website you want:

$url = "www.yourwebsite.com";

function get_tw_shares($url)

{

$call = "http://cdn.api.twitter.com/1/urls/count.json?url=" . rawurlencode($url);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $call);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$output = curl_exec($ch);

curl_close($ch);

return json_decode($output);

}

$tw_shares = get_tw_shares($url);

$shares = $tw_shares->count;

echo $shares;

Añadir comentario