Twitter API : /1.1/statuses/retweet/:id returns “无法对您进行身份验证”,”code”:32

Twitter API : /1.1/statuses/retweet/:id returns "Could not authenticate you”,”code”:32

我正在使用 Twitter api 获取特定推文的转推

 $url =    "https://api.twitter.com/1.1/statuses/retweet/830785820722343937.json";
 $requestMethod = 'POST';
  $getfield = "";

 $twitter = new TwitterAPIExchange($settings);
 $string = $twitter->setGetfield($getfield)
         ->buildOauth($url, $requestMethod)
         ->performRequest();
 $string = json_decode($string,$assoc = TRUE);

但是出现这个错误

[code] => 32 [message] => Could not authenticate you.

请帮忙

$url$requestMethod 替换后试试

$url = "https://api.twitter.com/1.1/statuses/retweets/830785820722343937.json";
$requestMethod = 'GET';

有关更多信息,请参阅 https://dev.twitter.com/rest/reference/get/statuses/retweets/id

正如我在评论中提到的,代码中使用的 $url$requestMethod 不是为了获得转发。您正在使用其他东西,请参阅 https://dev.twitter.com/rest/reference/post/statuses/retweet/id 了解它并找出不同之处。