3

我正在使用带有 OAuth 的 twitter api。

当我尝试检查我使用此 API 发送的推文时,如果推文存在,API 工作正常。但是,如果我删除了 API 发布的推文,推文检查响应总是给我:

            (
                [message] => Sorry, that page does not exist
                [code] => 34
            )

回复。

我正在尝试使用此代码块:

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $userKey, $userKeySecret);
$postResult = $connection->get('statuses/show', array('id' => "209985431515828224"));

在此 API 正常运行前 1 个月,它会给我“未找到状态”响应,但现在它给出了该错误。

这是一个错误还是这是已删除推文的默认响应?

4

1 回答 1

4
  1. 确保您使用了正确的 API 方法:GET statuses/show/:id
  2. 确保推文仍然存在
  3. 确保您始终依赖 id_str

使用 abraham 的 twitteroauth 方法的示例来自:https ://github.com/abraham/twitteroauth

$valid_id_str="209985431515828224";

$parameters = array('trim_user' => 1 );

$status = $connection->post('statuses/show/'.$valid_id_str,$parameters);
于 2014-08-29T10:43:55.063 回答