Reputation: 48453
I am using this block of code for getting my followers:
$trends_url = "http://api.twitter.com/1/statuses/followers/myname.json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $trends_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$curlout = curl_exec($ch);
curl_close($ch);
$response = json_decode($curlout, true);
foreach($response as $friends){
echo $friends['name'];
}
The problem is, that I can't get the whole list, just 100 followers. Is there any way to get all people which follows me?
Upvotes: 1
Views: 846
Reputation: 5
enter code here $user_id = $_GET['user_id'];
$screen_name = $_GET['screen_name'];
$name = $_GET['searchname'];
$code = $connection->get('followers/list', array('screen_name' => $screen_name,'user_id' => $user_id));
Blockquote This is usefull for all followers get
Upvotes: 0
Reputation: 4984
Paging has been implemented using the cursor
parameter. Your initial request should look like:
http://api.twitter.com/1/statuses/followers/myname.json?curosr=-1
The response will have a parameter containing the value of the next cursor.
Example:
{ ...
"next_cursor" : 1408398970289681313,
"next_cursor_str" : "1408398970289681313",
"previous_cursor" : -1409120171445568880,
"previous_cursor_str" : "-1409120171445568880"
}
You will need to make additional calls using the cursor identifier returned from each response.
Your next request would look like:
http://api.twitter.com/1/statuses/followers/myname.json?curosr=1408398970289681313
You can also include the count
parameter with each request to specify the total records returned.
Twitter API Wiki:
https://dev.twitter.com/docs/api/1/get/statuses/followers
Upvotes: 2
Reputation: 3546
This function of the Twitter API is deprecated. It only returns the first 100 followers that have recently tweeted. Check out this link for more info: Followers Twitter API Info
Upvotes: 0
Reputation: 4147
The twitter API returns pages of 100 items. You must make several requests, as many as want to get user pages.
Upvotes: 0