【问题标题】:Sorry, that page does not exist [code] => 34抱歉,该页面不存在 [code] => 34
【发布时间】:2015-06-24 04:52:21
【问题描述】:

POST /statuses/retweet 给了我这个错误,而POST statuses/tweetGET search/tweets 工作正常。

public $host = "https://api.twitter.com/1.1/";

$con = $this->oauth();
$retweets = $con->post('statuses/retweet/', array('id' => $searchid));

查询将获得对象的状态id_str。它是字符串格式。

/**
* POST wrapper for oAuthRequest.
*/
function post($url, $parameters = array()) {
   $response = $this->oAuthRequest($url, 'POST', $parameters);
   if ($this->format === 'json' && $this->decode_json) {
      return json_decode($response);
   }
   return $response;
}

API 控制台没有给我任何错误:

https://api.twitter.com/1.1/statuses/retweet/{id}.json

【问题讨论】:

    标签: php post twitter oauth


    【解决方案1】:

    如果你想转发 ID 为 1234 的推文,你需要发送一个 POST 请求到

    https://api.twitter.com/1.1/statuses/retweet/1234.json
    

    您似乎正在尝试向

    执行 GET 请求
    https://api.twitter.com/1.1/statuses/retweet/?id=1234
    

    【讨论】:

    • 哦,对不起。我正在检查 get 是否正常工作。实际上它在做 POST。
    【解决方案2】:

    想通了。转推 ID 不能作为参数发送。它必须作为 url 的一部分添加。 这就是我所做的。参数为空

    $retweets = $con->post('statuses/retweet/'.$searchid, null);
    

    【讨论】:

      猜你喜欢
      • 2012-10-06
      • 2023-02-20
      • 2017-12-12
      • 2015-04-22
      • 2016-02-26
      • 2014-03-10
      • 2021-07-04
      • 2012-10-13
      • 1970-01-01
      相关资源
      最近更新 更多