Php LinkedIn Api-未捕获异常';OAutheException';
我目前正试图在我的网站上安装LinkedIn的登录按钮。我正试图一步一步地进行开发,正如开发人员部分所示。在我编写代码以获取请求令牌并使用print\r检查它之后Php LinkedIn Api-未捕获异常';OAutheException';,php,api,oauth,linkedin,fatal-error,Php,Api,Oauth,Linkedin,Fatal Error,我目前正试图在我的网站上安装LinkedIn的登录按钮。我正试图一步一步地进行开发,正如开发人员部分所示。在我编写代码以获取请求令牌并使用print\r检查它之后 define("my consumer key"); define("my consumer secret"); $oauth = new OAuth(my consumer key, my consumer secret); //The first item of business is getting a request to
define("my consumer key");
define("my consumer secret");
$oauth = new OAuth(my consumer key, my consumer secret);
//The first item of business is getting a request token
$request_token_response = $oauth->getRequestToken('https://api.linkedin.com/uas/oauth/requestToken');
if($request_token_response === FALSE) {
throw new Exception("Failed fetching request token, response was:"
. $oauth->getLastResponse());
} else {
$request_token = $request_token_response;
}
print "Request Token:\n";
printf(" - oauth_token = %s\n", $request_token['oauth_token']);
printf(" - oauth_token_secret = %s\n", $request_token['oauth_token_secret']);
print "\n";
我得到了“致命错误:未捕获的异常‘OAuthException’…对等证书无法使用已知CA证书进行身份验证”。下面是为错误调用的行
$request_token_response = $oauth->getRequestToken('https://api.linkedin.com/uas/oauth/requestToken');
我不明白这个错误试图告诉我什么,以便我可以解决问题。我希望您能提供一些提示或指导,帮助我更好地理解此错误消息试图传达的内容以及如何修复它。库似乎正在尝试验证SSL证书,但它无法这样做。您可以通过OAuth::disableSSLChecks方法禁用ssl检查。我假设您正在使用以下pecl扩展。如果不是,您正在使用的客户端库应该有一个禁用SSL证书验证的方法
....
...
$oauth = new OAuth(my consumer key, my consumer secret);
$oauth->disableSSLChecks();
..
...
理想情况下,您应该在实例化后立即执行该操作我该如何调用该方法?@Octavius
$oauth->disableSSLChecks()
输入代码并获得未捕获的异常“OAuthException”,消息为“无效的身份验证/错误的请求?”?常量声明似乎错误,因为它没有常量的伴随值,请检查此页面developer.linkedin.com/documents/get-oauth-token-php中的声明