문제

I'm damned if I can make this work. Your help would be appreciated. I have valid access tokens, and can use twitteroauth to post status updates. However: every way I've tried to come at retweets has failed.

$parameters = array('id' => $status_id);
$retweet = $connection->post('statuses/retweet', $parameters);

Gets an error response of "not found." I'm not sure what's not found - the id of the tweet that I'm trying to retweet, or the method I'm calling (statuses/retweet). I'm passing valid ID's through the request (I can find them on Twitter), and so on. Any ideas?

Here's the documentation: http://dev.twitter.com/doc/post/statuses/retweet/:id

I've also tried:

$parameters = array('id' => $status_id);
$retweet = $connection->post('statuses/retweet/', $parameters);

$parameters = array('id' => $status_id);
$retweet = $connection->post('statuses/retweet/:', $parameters);

and...

$retweet = $connection->post('statuses/retweet/:123456.json');

With either null responses (??) or the same enigmatic "not found."

도움이 되었습니까?

해결책

$retweet = $connection->post('statuses/retweet/123456');

:id is a variable syntax that similar to PHP's $id so you replace it in its entirety with the value.

$parameters is only used when the key value pairs are getting added as URL parameters like ?key=value not in the URL path.

The format is automatically handled by the library so you should not include .json manually.

다른 팁

Another tip on this issue is to reference "id_str" rather than the "id" as the "id" integer is sometimes wrong.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top