Skip to content

Instantly share code, notes, and snippets.

@edwardteach42
Created January 26, 2012 21:22
Show Gist options
  • Save edwardteach42/1685193 to your computer and use it in GitHub Desktop.
Save edwardteach42/1685193 to your computer and use it in GitHub Desktop.
Get Number of Followers on Twitter
/**
* Get Number of Twitter Followers
*
* LICENSE: distributions of the source code without
* authors permission is forbidden, For written
* permission please contact jeffmthomas@gmail.com.
*
* Can also use the following to pull with $getData:
* id
* name
* screen_name
* location
* description
* profile_image_url
* url
* friends_count
* created_at
* lang
*/
$screenName = '';
$getData = 'followers_count';
$xml = file_get_contents('http://twitter.com/users/show.xml?screen_name=' . $screenName);
if(preg_match('/' . $getData . '>(.*)</', $xml, $match) !=0)
echo $match[1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment