I'm using Abraham
twitter library to search for tweets. All is going fine, but the problem is, my search returns more than 100 results.
Is there an easy way to loop through, like paging using the newer v1.1 of the API?
I need to be able to get all of the tweets via the search from a particular search, then loop through each of the results to create an array
This is what I currently have:
$connection = new Abraham\TwitterOAuth\TwitterOAuth(
‘KEY',
‘KEY',
‘KEY',
‘KEY'
);
$statuses = $connection->get("search/tweets”,
array(
"q" => ’something',
"result_type" => "recent",
"include_entities" => true,
"count" => 100
)
);
// possibly put into a loop - paging
var_dump($statuses->statuses)
gives me an array of objects (100)
So lets say my search term returned 298 results. Based on my code above, I’d have 3 pages
so to speak.
I was wondering what the best approach for this is?
The search terms I’m using a some what popular, maybe 100 a minute. I'm looking at running this via a cronjob, every hour, lets say, so I could have 600-1000 tweets in my array
I’ve seen the since_id
and max_id
, but not sure how I’d use these in my application.
I’m looking to store the tweets in a database, so I could potentially use the since_id
and/or ‘max_id’
Thanks