twitter api 总是给出“对不起,该页面不存在";删除推文的错误

编程入门 行业动态 更新时间:2024-10-21 17:23:26
本文介绍了twitter api 总是给出“对不起,该页面不存在";删除推文的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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_str

Example 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:关键词]

本文发布于:2023-04-29 15:47:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1192119.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不存在   错误   页面   twitter   api

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!