Second page always empty when using paging


#1

i know it must be something i am doing. I am using twitteroauth and rest1.1 search GET search/tweets

it gets the first page perfect, i set the max_id parameter to the oldest tweet in the list and do a second get, count says max number but statuses is always an empty array.

any ideas what i might be doing wrong? i can’t seem to get past the first page of results no matter how hard i try.


#2

So to clarify

// set my parameters
$this->parameters = array();
$this->parameters['result_type'] = "mixed";
$this->parameters['include_entities'] = 1;
$this->parameters['q'] = "test";
$this->download();

function download() {
  //then i connect and download
  $results = $this->connection->get('search/tweets', $this->parameters);

  //parse results
  foreach($results->statuses as $status) {
    $this->parameters['max_id'] = $status->id-1;
    echo "Post: ".$status->text." from: ".$status->user->screen_name;
  }

  // check if next page exists
  // if ($results->search_metadata->count == 15) { // full count of returned items. Stopped using this cause it always returns the full number.

  if (array_key_exists("results_next", $results->search_metadata)) {
    $this->download();
  }
}

first results works 100% but as soon as i add the max_id i get an empty statuses array.
And if i run the same query and change from 15 to 30 i get 30 responses instead of 15 but the second result is empty.


#3

if it helps this is the json results i get off the second call

{"statuses":[],"search_metadata":{"completed_in":0.05,"max_id":307496364764450816,"max_id_str":"307496364764450816","query":"django","refresh_url":"?since_id=307496364764450816&q=django&result_type=mixed&include_entities=1","count":15,"since_id":0,"since_id_str":"0"},"httpstatus":200}

I also switched to trying the codebird.php libraries but it is doing the same thing.


#4

So strangly even if i enter max_id in the OAuth tool for my application it comes back empty.
As does the example for the paging.


#5

anyone? i really need to figure out why paging doesn’t work. even if i do it in the API Tools i can’t use max_id for anything.


#6

I’m facing same issue, and wrote it here https://dev.twitter.com/discussions/15328

Any input is appreciated

Regards