Tag Archives: Twitter

PHP Twitter Followers Count script (v1.1 API)

Php Twitter Followers Count

The following PHP Twitter Followers Count script is using the new v1.1 Twitter API.



Recently, Twitter have changed their API and v1.0 is obselete. The new API requires OAuth. I’ll explain how to get your twitter followers count using PHP.


Create Application

First, you’ll need to get yourself a twitter dev account, if you haven’t done so yet.

Go here and register your app free.



Download the TwitterAPIExchange library files created by J7mbo into your application.

you can git clone https://github.com/J7mbo/twitter-api-php.

I recommend the git method as you can git pull later to recieve updated.


Get Followers Count

Insert your OATH and Consumer Access-Token & Access-Token secret the the following code. Also, change the $getfield screen name to yours.

Now combine everything to make it work


/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
'oauth_access_token' => "YOUR_OAUTH_ACCESS_TOKEN",
'oauth_access_token_secret' => "YOUR_OAUTH_ACCESS_TOKEN_SECRET",
'consumer_key' => "YOUR_CONSUMER_KEY",
'consumer_secret' => "YOUR_CONSUMER_SECRET"

$ta_url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?screen_name=replace_me;
$requestMethod = '
$twitter = new TwitterAPIExchange($settings);
->buildOauth($ta_url, $requestMethod)
$data = json_decode($follow_count, true);
echo $followers_count;



I’ve placed the entire twitter-api-php folder inside my project. you can extract the files also, but make sure to require_once() from the correct path.


if you’ve placed it inside the folder, or

require_once(‘TwitterAPIExchange.php’); if you extracted the files to the same folder as your script.


More information

This article was based on the work of Jimbo and Meenakshi Sundaram R

Twitter hacked. users adviced to change all passwords and disable java!

You’ve been hacked?

Quarter of a million users (250,000) details had been stolen from twitter this week including: usernames, email addresses, session tokens and encrypted/salted versions of passwords Twitter becomes the latest US media giant to admit to being hacked,

Continue reading