How To: Display Twitter Followers List On Your Blog

Almost a year ago I’ve shared a simple script to display your Twitter followers count in your blog or website. But how to display followers list?. Have you ever tried? Today I’d like to share another simple php script to display your Twitter followers. This code is very simple. I think, it’ll be very helpful for you. Let’s get started

Step 1: Grab Followers List

The following php function grabs data from Twitter API in json format then it’ll decode the json format and displays your followers name, thumbnail and username.

function followers_list($user_name='')
$data = file_get_contents(''.$user_name.'.json&');
$response = json_decode($data,true);
foreach($response as $followers)
$name = $followers['name'];
$thumb_img = $followers['profile_image_url'];
$screen_name = $followers['screen_name'];
echo '<img src="'.$thumb_img.'" alt="'.$name.'" width="30" height="30" border="0" />
<a title="'.$name.'" href="'.$screen_name.'"><strong>'.$name.'</strong>

This is the main function. Copy and paste it your common functions file like config.php, main_functions.php, engin.php etc.. If you are a WordPress blogger open functions.php, paste this script and save the file.

Step 2: Display Followers List

To display your followers list, simply call this function wherever you want to display your Twitter followers list. for eg:

My Twitter Followers:<?php followers_list('lineshjose');?>

It’s very simple, right?

Note: This api returns 100 followers at a time. That means you can only list maximum 100 followers. Plese click the following link to know more about Twitter GET statuses/followers Api.