-
-
Save abraham/598349 to your computer and use it in GitHub Desktop.
<?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 do not know why, but an error like:
Warning: array_chunk() expects parameter 1 to be array, object given in script.php on line 16
Warning: Invalid argument supplied for foreach() in script.php on line 19
array(0) { }
ACCESS_TOKEN, ACCESS_SECRET is the same as OAUTH_TOKEN, OAUTH_SECRET? Right?
I think It should be like this
$ids_arrays = array_chunk($ids->ids, 100);
you can have look print_r($ids);
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.
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 ?
What is this CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_SECRET parameter how to get ??? i need follower of 'ankit' how to do that?
Thank in advance