Favorites/create in twitteroauth seems to return error 404 randomly


#1

I’ve seen this in a couple of discussions, and still can’t fix it.
It looks like Abraham William’s twitteroauth library (the most recent version, tailored for the 1.1 API) works perfectly but returns an error 404 randomly for the endpoint favorites/create.
I tried the following:


$method = ("favorites/create.json?id=$some_tweet_id");
sleep(10);
twitteroauth_row($method, $connection->post($method), $connection->http_code);
var_dump($connection->http_code);

and


$method = ("favorites/create/$some_tweet_id");
sleep(10);
twitteroauth_row($method, $connection->post($method), $connection->http_code);
var_dump($connection->http_code);

and I even tried posting the tweet id separately in an array. The endpoint favorites/create.json?id= returned 200 only once, and I don’t know why.
I thought the tweet id may be wrong, so I cut and pasted a real tweet id from twitter. There seems to be no way to make this work.
Has anyone seen this happen too?
Should there be any suggestions on how to fix this I’d be grateful.


#2

nevermind. You also have to check that the tweet variable you’re passing to the API isn’t empty (…). It works perfectly with “favorites/create” and the tweet id sent in a post data array as below:

$parameters = (array(‘id’ =>$some_tweet_id));
//don’t do like me, make sure $some_tweet_id is not null…