【发布时间】:2014-05-20 16:12:35
【问题描述】:
我在连接 twitter 时使用此 OAuth 库时遇到问题:
https://github.com/Lusitanian/PHPoAuthLib
我正在使用以下网址进行连接:
http://www.myserver.com/oauth/examples/twitter.php?go=go
我收到以下错误:
致命错误:未捕获异常 'OAuth\Common\Http\Exception\TokenResponseException' 并带有消息 'file_get_contents(https://api.twitter.com/oauth/request_token):无法打开流:HTTP 请求失败! HTTP/1.1 401 Unauthorized ' 在 /webDeploy/V2/sites/wandexBB/oauth/src/OAuth/Common/Http/Client/StreamClient.php:75 堆栈跟踪:#0 /webDeploy/V2/sites/wandexBB/oauth/src /OAuth/OAuth1/Service/AbstractService.php(52): OAuth\Common\Http\Client\StreamClient->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri), Array, Array) #1 /webDeploy/V2 /sites/wandexBB/oauth/examples/twitter.php(59): OAuth\OAuth1\Service\AbstractService->requestRequestToken() #2 {main} 在 /webDeploy/V2/sites/wandexBB/oauth/src/OAuth/ 中抛出Common/Http/Client/StreamClient.php 第 75 行
请求正文好像是空的。
我在代码中看到正在使用以下参数:
$_GET['oauth_token'],
$_GET['oauth_verifier'],
这些参数是什么?我在 Twitter 帐户中看到我在 twitter 上创建了我的应用程序后有各种可用的令牌,这与此有关吗?
我迷路了:/这可能完全是错误的方法。
有人可以帮忙吗?
提前致谢。
【问题讨论】:
标签: oauth twitter-oauth