0
我已經要求提升權限給Twitter,並且他們授予了我。所以現在我必須得到用戶註冊的電子郵件,但我不知道如何。 這是我的,有人知道我應該怎麼做?用Twitter API獲取電子郵件
if(isset($_REQUEST['oauth_token']) && $_SESSION['token'] == $_REQUEST['oauth_token']) {
//Successful response returns oauth_token, oauth_token_secret, user_id, and screen_name
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['token'] , $_SESSION['token_secret']);
$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier'], ["include_entities" => 'true', "skip_status" => 'true', "include_email" => 'true']);
if($connection->http_code == '200')
{
//Redirect user to twitter
$_SESSION['status'] = 'verified';
$_SESSION['request_vars'] = $access_token;
//Unset no longer needed request tokens
unset($_SESSION['token']);
unset($_SESSION['token_secret']);
header('Location: twconfig.php');
}else{
die("Ha surgido un error, por favor inténtelo denuevo más tarde.");
}
}