Hi!
Im using this code to get some API info from registered application
require $doc_root. '/auth/twitter/twitteroauth-master/twitteroauth.php';
require $doc_root. '/auth/twitter/twitteroauth-master/config.php';
if (empty($_SESSION['access_token'])
|| empty($_SESSION['access_token']['oauth_token'])
|| empty($_SESSION['access_token']['oauth_token_secret'])) {
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
$request_token = $connection->getRequestToken(OAUTH_CALLBACK);
$_SESSION['access_token'] = array();
$_SESSION['access_token']['oauth_token'] = $token = $request_token['oauth_token'];
$_SESSION['access_token']['oauth_token_secret'] = $request_token['oauth_token_secret'];
switch ($connection->http_code) {
case 200:
$url = $connection->getAuthorizeURL($token);
header('Location: ' . $url);
break;
default:
echo 'Could not connect to Twitter. Refresh the page or try again later.';
}
}
$access_token = $_SESSION['access_token'];
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
$content = $connection->get('account/verify_credentials');
var_dump($content);
but this return “Invalid or expired token”. Why this can happens ?