Skip to content

Instantly share code, notes, and snippets.

@0xnbk
Created September 13, 2010 06:30
Show Gist options
  • Save 0xnbk/576893 to your computer and use it in GitHub Desktop.
Save 0xnbk/576893 to your computer and use it in GitHub Desktop.
Get the number of twitter follower in full text (PHP)
<?php
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name=catswhocode');
if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
$tw['count'] = $match[1];
}
echo $tw['count'];
?>
@0xnbk
Copy link
Author

0xnbk commented Sep 13, 2010

Get the number of twitter follower in full text (PHP)

When you have a website or blog and use Twitter, it can be cool to display how many followers you have. To do so, simply use the short code snippet above.
Note that if you want to integrate the same code into WordPress, using caching, Rarst have written a nice code that you can get using the link after the snippets (Rarst code is in the comments, so scroll down a bit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment