Skip to content

Instantly share code, notes, and snippets.

@lslucas
Created October 25, 2010 16:01
Show Gist options
  • Save lslucas/645199 to your computer and use it in GitHub Desktop.
Save lslucas/645199 to your computer and use it in GitHub Desktop.
conta número de tweets que um determinado link teve
<?php
/*
* usage: echo tweetCount('http://google.com');
* ref: http://www.phpsnippets.info/get-how-many-times-a-page-have-been-retweeted-using-php
*/
function tweetCount($url) {
$content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url);
$element = new SimpleXmlElement($content);
$retweets = $element->story->url_count;
if($retweets){
return $retweets;
} else {
return 0;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment