开发者

How do I format a retweet request through the Abraham twitteroauth php class?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜