问题描述
限时送ChatGPT账号..我将 twitter api 与 OAuth 结合使用.
当我尝试检查使用此 API 发送的推文时,如果推文存在,API 工作正常.但是如果我删除了一条由 API 发布的推文,推文检查响应总是给我:
<块引用><代码> ([消息] =>抱歉,该页面不存在[代码] =>34)
回应.
我正在尝试使用此代码块:
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $userKey, $userKeySecret);$postResult = $connection->get('statuses/show', array('id' => "209985431515828224"));
在此 API 正常工作前 1 个月,它会给我未找到状态"响应,但现在它给出了该错误.
这是一个错误还是对已删除推文的默认响应?
解决方案 确保您使用正确的 API 方法:GET statuses/show/:id 确保推文仍然存在确保您始终依赖 id_str使用 abraham 的 twitteroauth 方法的示例来自:https://github/abraham/twitteroauth>
$valid_id_str="209985431515828224";$parameters = array('trim_user' => 1 );$status = $connection->post('statuses/show/'.$valid_id_str,$parameters);
I'm using twitter api with OAuth.
When I try to check tweet that i sent with this API, if tweet is exists API works fine. But if i deletede a tweet that posted by API, tweet check response always give me:
( [message] => Sorry, that page does not exist [code] => 34 )
response.
I'm trying with this code block:
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $userKey, $userKeySecret);
$postResult = $connection->get('statuses/show', array('id' => "209985431515828224"));
1 month before this API works fine and it will give me "No status found" response but now it gives that error.
Is this a bug or this is default response for deleted tweets?
解决方案 Make sure you're using the right API method: GET statuses/show/:id Make sure the Tweet still exists Make sure that you always rely on id_strExample using abraham's twitteroauth method from: https://github/abraham/twitteroauth
$valid_id_str="209985431515828224";
$parameters = array('trim_user' => 1 );
$status = $connection->post('statuses/show/'.$valid_id_str,$parameters);
这篇关于twitter api 总是给出“对不起,该页面不存在";删除推文的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论