我将 Twitter API 与 OAuth 结合使用。
当我尝试检查使用此 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"));
1 个月前这个 API 工作正常,它会给我“找不到状态”的响应,但现在它给出了那个错误。
这是错误还是这是对已删除推文的默认响应?
最佳答案
- 确保您使用的是正确的 API 方法:GET statuses/show/:id
- 确保推文仍然存在
- 确保始终依赖 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);
关于twitter api 总是为删除的推文提供 "Sorry, that page does not exist"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11186068/