twitter api 总是给出“对不起,该页面不存在";删除推文的错误 [英] twitter api always give "Sorry, that page does not exist" error for deleted tweets

查看:35
本文介绍了twitter api 总是给出“对不起,该页面不存在";删除推文的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 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 个月,它会给我未找到状态"响应,但现在它给出了该错误.

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

解决方案

  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);

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?

解决方案

  1. Make sure you're using the right API method: GET statuses/show/:id
  2. Make sure the Tweet still exists
  3. Make sure that you always rely on id_str

Example using abraham's twitteroauth method from: 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 总是给出“对不起,该页面不存在";删除推文的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆