大家晚上好
我正在使用来自 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/