tags:

views:

150

answers:

3

i want to get more than 20 users using the the twitter api in a single request is there any parameter that specifies it?

i am using this api http://api.twitter.com/1/Barelyme/Politics/members.xml?cursor=-1

+1  A: 

According to the Twitter List API Docs:
http://apiwiki.twitter.com/Twitter-REST-API-Method:-GET-list-members

You cant get more than 20 in a single request.

Jayrox
yes i cheked dis link but is there any special type of twitter account thru wch twitter can allow more than 20?
vakas
it doesnt appear so. normally if there are exceptions twitter will have them listed. looking at the docs it appears a hard coded 20 per request
Jayrox
A: 

prolly not tho you can poll multiple times >1 for more data. given that twitter said you acn't do it you probly cant

stan
A: 

If you're using twitteroauth by abraham, you can iterate through the pages of list members (this example assumes $connection is already defined by a functional implementation of twitteroauth):

$user = $connection->get('account/verify_credentials'); //Gets/Tests credentials
$listmembers = $connection->get("{$user->screen_name}/LISTNAMEORID/members"); //Gets first page of list members; MUST edit "LISTNAMEORID"
$pagevalue = ""; //Set page value for later use

if($listmembers->next_cursor == 0){ //There is only one page of followers
    for ($j=0, $k=count($listmembers->users); $j<$k; $j++){
        //Your actions here
        //print_r($listmembers); //Displays the page of list members
    }
} else { //There are multiple pages of followers
    while ($pagevalue!=$listmembers->next_cursor){
        for ($j=0, $k=count($listmembers->users); $j<$k; $j++){
            //Your actions here
            //print_r($listmembers); //Displays the page of list members
        }
        $pagevalue = $listmembers->next_cursor; //Increment the 'Next Page' link
        $listmembers = $connection->get("{$user->screen_name}/LISTNAMEORID/members", array('cursor' => $pagevalue)); //Gets next page of list members; MUST edit "LISTNAMEORID"
    }
}
James Chevalier