Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在Abraham twitteroauth课上需要帮助吗_Php_Twitter Oauth - Fatal编程技术网

Php 在Abraham twitteroauth课上需要帮助吗

Php 在Abraham twitteroauth课上需要帮助吗,php,twitter-oauth,Php,Twitter Oauth,我正在学习如何使用twitter 在用OAuth页面验证请求时,我正在用给定的过程调试代码 在将用户发送到授权部分中,写着 如果您使用的是回调流, 您的oauth_回调应该 已收到您的oauth_令牌( 与您发送的相同,您的“请求” 标记)和一个名为 oauth_验证器。你会需要它的 下一步 以下是我收到的回复: oauth_令牌=8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc&oauth_校验器=pDNg57prOHapMbhv25RNf75lVRd6JDs

我正在学习如何使用twitter 在用OAuth页面验证请求时,我正在用给定的过程调试代码

将用户发送到授权部分中,写着

如果您使用的是回调流, 您的oauth_回调应该 已收到您的oauth_令牌( 与您发送的相同,您的“请求” 标记)和一个名为 oauth_验证器。你会需要它的 下一步

以下是我收到的回复:

oauth_令牌=8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc&oauth_校验器=pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY

我的原始代码是

require_once('twitteroauth/twitteroauth.php');
require_once('config.php');

/* Build TwitterOAuth object with client credentials. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
 
/* Get temporary credentials. */
$request_token = $connection->getRequestToken(OAUTH_CALLBACK);


/* Save temporary credentials to session. */
$_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
/* If last connection failed don't display authorization link. */
switch ($connection->http_code) {
  case 200:
    /* Build authorize URL and redirect user to Twitter. */
    echo "<br/>Authorize URL:".$url = $connection->getAuthorizeURL($token);
    //header('Location: ' . $url); 
    break;
  default:
    /* Show notification if something went wrong. */
    echo 'Could not connect to Twitter. Refresh the page or try again later.';
}

我没有得到上面有oauth\u验证器的URL。请告诉我从何处查看/调试该url???

在您从
返回后,
oauth_验证程序是url上的一个参数https://twitter.com/oauth/authenticate?oauth_token=xyz
。因此,如果您的回调url是
http://example.com/oauth/complete
在twitter.com上单击“允许”后,您应该在
http://example.com/oauth/complete?oauth_token=xyz&oauth_verifier=xyz

https://twitter.com/oauth/authenticate?oauth_token=BHqbrTjsPcyvaAsfDwfU149aAcZjtw45nhLBeG1c