我正在与亚伯拉罕的twitteroauth合作,在我的应用程序中实现Twitter OAuth。在运行我的应用程序时,这是我遇到的错误:
Notice: Undefined index: oauth_token in /opt/lampp/htdocs/twitta/redirect.php on line 432
Notice: Undefined index: oauth_token_secret in /opt/lampp/htdocs/twitta/redirect.php on line 433
Notice: Undefined property: Abraham\TwitterOAuth\TwitterOAuth::$http_code in /opt/lampp/htdocs/twitta/redirect.php on line 435
Notice: Undefined property: Abraham\TwitterOAuth\TwitterOAuth::$http_code in /opt/lampp/htdocs/twitta/redirect.php on line 442
OOOOOPS
这是引发上述错误的redirect.php
文件的一部分:
require('config.php');
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
$request_token = $connection->oauth(OAUTH_CALLBACK);
$_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
switch($connection->http_code)
{
case 200:
$url = $connection->getAuthorizeURL($token);
header('Location:' . $url);
break;
default:
echo "OOOOOPS" . $connection->http_code;
}
我的代码似乎有什么问题?
编辑:
根据评论部分的某些人的建议,我尝试var_dump()
$request_token
变量,这就是输出的内容:
所有输出的内容都是var_dump($request_token);