Skip to content

Instantly share code, notes, and snippets.

@mebcomputers
Created April 27, 2012 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mebcomputers/2505346 to your computer and use it in GitHub Desktop.
Save mebcomputers/2505346 to your computer and use it in GitHub Desktop.
php: get twiiter followers amount
function get_followers($twitter_id){
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name='.$twitter_id);
if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
$tw['count'] = $match[1];
}
return $tw['count'];
}
$nb = get_followers('phpsnippets');
echo "PHP Snippets already have ".$nb." followers!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment