php api接口 致命错误,致命错误cURL错误60使用Tumblr PHP API时

我试图通过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 . "!";

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值