Created
September 26, 2010 21:53
-
-
Save abraham/598349 to your computer and use it in GitHub Desktop.
Quick script to get all of the followers for Twitter users.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Require the TwitterOAuth library. http://github.com/abraham/twitteroauth | |
require_once('twitteroauth/twitteroauth.php'); | |
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_SECRET); | |
// Empty array that will be used to store followers. | |
$profiles = array(); | |
// Get the ids of all followers. | |
$ids = $connection->get('followers/ids'); | |
// Chunk the ids in to arrays of 100. | |
$ids_arrays = array_chunk($ids, 100); | |
// Loop through each array of 100 ids. | |
foreach($ids_arrays as $implode) { | |
// Perform a lookup for each chunk of 100 ids. | |
$results = $connection->get('users/lookup', array('user_id' => implode(',', $implode))); | |
// Loop through each profile result. | |
foreach($results as $profile) { | |
// Use screen_name as key for $profiles array. | |
$profiles[$profile->screen_name] = $profile; | |
} | |
} | |
// Array of user objects. | |
var_dump($profiles); |
i'm getting error
Fatal error: Class 'Abraham\TwitterOAuth\Config' not found in C:\xampp\htdocs\Twi_proj3\TwitterOAuth\TwitterOAuth.php on line 16
i want to get all the followers of users and want to download list in csv or any other formet, so this will help or not?
Can this will come to 'rate limit exceeded' error of twitter api or not ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I personally suggest to use WizUgo for twitter automation. And the reason is that I have used this tool and my experience is amazing. It gave me a lot of followers. Now you don’t need to invest time in competing with other twitter accounts as WizUgo has got your back for this, in fact for everything. You don’t need to do anything you can just relax and WizUgo will get you followers, likes and comments. And you can also schedule your tweets too. So easy to use and still got lots of potential. I just love WizUgo for all the services it has.