You make ’ id_list.txt ’
function.php;
<?php
function getFollowers($screen_name)
{
global $connection;
$followersList = array();
$cursor = -1;
do{
$followers = $connection->get('/followers/ids', array('count' => 5000, 'screen_name' => $screen_name, 'cursor' => $cursor));
if(!isset($followers->errors))
{
$cursor = $followers->next_cursor_str;
if(is_array($followers->ids))
{
foreach($followers->ids as $ids)
{
saveTextFile("id_list.txt","$ids\n");
}
}
if(is_null($cursor))
$cursor = 0;
if($connection->http_header["x_rate_limit_remaining"] == 0)
break;
}
else
{
return $followers->errors;
}
}while($cursor != 0);
return $followersList;
}
function saveTextFile($file,$data)
{
$txtFile = fopen($file,"a");
if($txtFile)
{
fwrite($txtFile, $data);
}
fclose($txtFile);
}
index.php;
<?php
set_time_limit(0);
require_once('twitteroauth/twitteroauth.php'); // https://github.com/abraham/twitteroauth
require_once('function.php');
$consumer_key = 'xxxxxxxxxxxxxxx';
$consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxx';
$access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$access_token_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$connection = new TwitterOAuth($consumer_key, $consumer_secret,$access_token,$access_token_secret);
$aliOS = 'username';
getFollowers($aliOS);
?>