Error trying to perform retweet using TwitterAPIExchange.php
I try to occupy this code:
<?php
ini_set('display_errors', 1);
require_once('TwitterAPIExchange.php');
function RT($id){
$settings = array(
'oauth_access_token' => 'xxxxxxx',
'oauth_access_token_secret' => 'xxxxxx',
'consumer_key' => 'xxxxxx',
'consumer_secret' => 'xxxxxxxx',
);
$url = 'https://api.twitter.com/1.1/statuses/retweet/'.$id.'.json';
$requestMethod = 'POST';
$twitter = new TwitterAPIExchange($settings);
return $twitter->buildOauth($url, $requestMethod)->performRequest();
}
echo RT("901856631855730689");
?>
This error appears when executing the code
{"errors": [{"code": 32, "message": "Could not authenticate you."}]}
Some idea of what the reason is.