Get a user's Followers Count using API v1.1


I want to get the followers count of a user. I want to use this : “”.

When I call a url like “” , it gives “Bad Authentication”.

I created an app & got my token codes but don’t know how to use them. Can you please help.

Basically, I want to get a user’s follower count using JavaScript.


It’s unfortunately not really possible to use API v1.1 in pure Javascript environments without exposing your consumer keys. OAuth 1.0A and our app-only auth model are best suited for server-to-server programming. Have you taken a look at [node:13439]?


Okay. So, can we do the same using php? If yes, how to do it?


Here’s one example for getting twitter user data. The amount of results if limited though.


function getTwitterData($username){
$consumer_key = “xxxxxxxxxxxxxxxxxxx”;
$consumer_secret = “xxxxxxxxxxxxxxxxxxx”;

$oauth_token = "xxxxxxxxxxxxxxxxxxx";
$oauth_token_secret = "xxxxxxxxxxxxxxxxxxx";
$connection = new TwitterOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
$user = $connection->get(''.$username);

return $user;



Thank you @fhollste

closed #6