Display Number of Twitter Followers With PHP
The usefulness of displaying the number of followers also varies, apart from personal statistics, displaying the number of followers is also to make others believe that the website is serious, so it is not uncommon for many people to use the services of a certain person/company to increase the number of followers (we do not will discuss that here).
Previously, tutorial-webdesign.com also discussed how to display the Twitter timeline on a website page, this trick can be combined if needed.
Image credit: Lakeshorebranding.com
Okay, straight to the topic, here we will use PHP to display the number of followers. Enough with just 4 lines of PHP code.
Create a file with the name twitter_followers_count.php , and fill it as follows
$twitter_id = “tut_web”;
$url = “http://twitter.com/users/show/$twitter_id”;
$response = file_get_contents ( $url );
$count = 0;
$t_profile = new SimpleXMLElement ( $response );
$count = $t_profile->followers_count;
To display it on the web page, simply print it as usual.