我试图通过Tumblr PHP API对用户进行身份验证。
我收到此错误
致命错误:未捕获的异常
' GuzzleHttp \异常\ RequestException'消息' cURL错误60:
SSL证书问题:无法获得本地颁发者证书(请参阅
http://curl.haxx.se/libcurl/c/libcurl-errors.html)'
访问建议的网站时,这是对错误60的解释
CURLE_SSL_CACERT(60)
无法使用已知的CA证书对对等证书进行身份验证。
我发现了一个类似的问题here,但我该如何修复我的问题?它是一样的吗?
这是我尝试使用的代码
require_once('vendor/autoload.php');
$consumerKey = 'XXX';
$consumerSecret = 'YYY';
$client = new Tumblr\API\Client($consumerKey, $consumerSecret);
$requestHandler = $client->getRequestHandler();
$requestHandler->setBaseUrl('https://www.tumblr.com/');
// If we are visiting the first time
if (!$_GET['oauth_verifier']) {
// grab the oauth token
$resp = $requestHandler->request('POST', 'oauth/request_token', array());
$out = $result = $resp->body;
$data = array();
parse_str($out, $data);
// tell the user where to go
echo ' GO ';
$_SESSION['t']=$data['oauth_token'];
$_SESSION['s']=$data['oauth_token_secret'];
} else {
$verifier = $_GET['oauth_verifier'];
// use the stored tokens
$client->setToken($_SESSION['t'], $_SESSION['s']);
// to grab the access tokens
$resp = $requestHandler->request('POST', 'oauth/access_token', array('oauth_verifier' => $verifier));
$out = $result = $resp->body;
$data = array();
parse_str($out, $data);
// and print out our new keys we got back
$token = $data['oauth_token'];
$secret = $data['oauth_token_secret'];
echo "token: " . $token . "
secret: " . $secret;
// and prove we're in the money
$client = new Tumblr\API\Client($consumerKey, $consumerSecret, $token, $secret);
$info = $client->getUserInfo();
echo "
congrats " . $info->user->name . "!";
}