In: PHP
December 29th, 2010.Get number of Twitter followers using this PHP snippet is easy. Once you get all the data from Twitter, you just have to isolate followers_count. Besides followers count, you can extract following data as well:
Now, finally, to get number of Twitter followers, use following snippet:
1 2 3 4 5 6 7 | $screenName = 'stuntsnippets'; $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]; |
Notice: Don’t forget to do some PHP caching for your script. You don’t want to have too many requests toward Twitter.