Created
October 25, 2010 16:01
-
-
Save lslucas/645199 to your computer and use it in GitHub Desktop.
conta número de tweets que um determinado link teve
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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