php - 推特 API 错误 220 - : twitteroauth

标签 php api twitter

大家晚上好

我正在使用来自 https://github.com/abraham/twitteroauth 的 PHP 代码

登录工作正常,但在尝试向 Twitter 发布状态时出现以下错误:

stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [code] => 220 [message] =>      Your credentials do not allow access to this resource. ) ) )

我正在使用以下代码:

session_start();
require_once('twitteroauth/twitteroauth.php');
require_once('config.php');

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'],
$_SESSION['oauth_token_secret']);

$token_credentials = $connection->getAccessToken($_REQUEST['oauth_verifier']);


$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $token_credentials['oauth_token'],
$token_credentials['oauth_token_secret']);

$account = $connection->get('account/verify_credentials');
$status = $connection->post('statuses/update', array('status' => 'Text of status here'));

我已按照与网站相同的说明进行操作。我哪里错了?

最佳答案

在你的情况下,你必须在 twitter 上创建一个 api 吗? https://apps.twitter.com/ 如果这样做,请检查您的 api 的配置。 此链接可能会有所帮助。 https://dev.twitter.com/docs/auth/oauth/faq

关于php - 推特 API 错误 220 - : twitteroauth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19865663/

相关文章:

php - 我如何比较Php中的两个时间变量

php - CodeIgniter 中 $query>num_rows() 和 $this->db->count_all_results() 之间的区别 & 推荐哪一个

javascript - 现场示例 Spotify WEB 应用程序

ruby-on-rails - 带有嵌套参数 cUrl 的多部分 POST

javascript - 如何使用 javascript 使用 Twitter API

php - Mysqli 弄乱了我的 while 循环

php - 如何调用另一个命名空间中的方法

api - 在YouTube API v3中无法获取视频时长

api - 为什么 Twitter 不赞成在他们的 API 中使用 DELETE 作为请求方法?

javascript - <a> 无法在 JavaScript 字符串中工作