PHP

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('http://twitter.com/users/show.xml?screen_name='.$twitter_id); if (preg_match('/followers_count>(.*)

Back to top ^

Join Paulund

  • Get access to 100s of premium tutorials and downloadable content
  • Members content consists of Premium WordPress plugins, CSS packages, jQuery packages, tutorial demo files and templates for 100s of web development tutorials
  • In-depth development tutorials
  • Priority tutorial requests
  • Priority email development support
  • No ads

Here at Paulund you'll find Web Development tutorials and snippets focusing mainly on PHP, WordPress and CSS. Members will get access to premium tutorials that go into more detail about development with these languages. You will also get access to downloadable premium content based on the tutorial.

Join Paulund

Leave a Reply

Your email address will not be published. Required fields are marked *