max_id doesn't work


#1

Code:

$twitterObj = new Tw_EpiTwitter($credential1, $credential2, $credential3, $credential4);

$options = array(
‘count’ => 1,
‘max_id’ => 99999999999999999999999999 * 999999999999999999999999 * 999999999999,
);
$statuses = $twitterObj->get(’/statuses/home_timeline.json’, $options);
var_dump($statuses->response);exit;

Here is the code. Output is
array(0) { }
There are 2 tweets in my account. With ids 245170210548621312 and 245159774507921408
Why the output is an empty array? I tested to set max_id to 245170210548621312 - 1, but the same result. What is wrong? Thanks!


#2

I would not recommend feeding such high numbers as max_id.

The home timeline is volatile. It only goes back 800 statuses and depending on the accounts the authenticating user is following, that can be only a few minutes or hours in the past. If you’re looking for specific tweets that were authored by a specific account, you’d be better of examining their user timeline instead.

You should also make sure you’re using the correctly versioned paths. The library you’re using hasn’t been updated in some time.


#3

@episod what library would you advise me to use ?


#4

If you’re most comfortable with PHP, tmhOAuth is a very simple wrapper around HTTP and OAuth that makes interacting with any Twitter REST API pretty easy and consistent: https://github.com/themattharris/tmhOAuth