Display twitter followers count

This snippet grabs the number of followers the specified user has.

Change USERNAME to the Twitter username you want to get the stats from.

Code Snippet:

<?php
$twit = file_get_contents('http://twitter.com/users/show/USERNAME.xml');
$begin = '<followers_count>'; $end = '</followers_count>';
$page = $twit;
$parts = explode($begin,$page);
$page = $parts[1];
$parts = explode($end,$page);
$tcount = $parts[0];
if($tcount == '') { $tcount = '0'; }
    echo '<b> '.$tcount.' </b> followers.';
?>

Posted in Social