Display number of Twitter followers in your Wordpress based website


/ Published in: PHP
Save to your folder(s)

Put this code in your theme, where you want to show followers count. Don't forget to change USERNAME.xml to your twitter user name.


Copy this code and paste it in your HTML
  1. <?php
  2. $twit = file_get_contents('http://twitter.com/users/show/USERNAME.xml');
  3.  
  4. $begin = '<followers_count>'; $end = '</followers_count>';
  5. $page = $twit;
  6. $parts = explode($begin,$page);
  7. $page = $parts[1];
  8. $parts = explode($end,$page);
  9. $tcount = $parts[0];
  10.  
  11. if($tcount == '') { $tcount = '0'; }
  12. echo '<b> '.$tcount.' </b> Followers';
  13. ?>

URL: http://www.webm.ag/2010/02/05/how-to-display-your-feedburner-count-and-twitter-followers-without-chicklets/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.