Get Twitter Followers From Twitter XML

As of March 5th 2013 this technique will not work anymore as this uses the old Twitter API, to learn how to use the new Twitter API have a look at this tutorial.

Using The New Twitter API V1.1

Twitter XML

Use the twitter to access your account or any account and return the number of followers you have. Many websites like to do this so that they can show how popular they are on Twitter hoping this will encourage more people to follow them.

Below is a small PHP snippet which will access a piece of XML for your account and grab your followers count so you can display this on your website. As this snippet is getting XML about your profile it will also return lots more data which you can use the same approach to get certain data from the XML.

function get_followers($twitter_id){ $xml=file_get_contents(''.$twitter_id); if (preg_match('/followers_count>(.*)Back to top

Gain access to all tutorials

  • Premium tutorials covering WordPress, Laravel and VueJS
  • Download premium content
  • Download premium WordPress plugins
  • Only $5 a month

Join Paulund