问题描述:

Good evening all,

I am using the PHP code from https://github.com/abraham/twitteroauth

The login works perfectly but when trying to post a status to Twitter i get the following error:

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

I am using the following code:

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

I have followed the same instructions as the website. Where am i going wrong?

网友答案:

In your case do you have to create an api on twitter ? https://apps.twitter.com/ If you did, check the configuration of your api. this link could be helpful. https://dev.twitter.com/docs/auth/oauth/faq

相关阅读:
Top