最近搞了一个卡密授权接口,使用派api框架。出现问题ssl验证无法通过,报错curl: (60) SSL certificate problem: unable to get local issuer certificate,原因是Let's Encrypt因更换根证书,部分老旧设备访问时可能提示不可信。
接口执行流程如下:
1.通过curl向卡密验证接口提交卡密
$keyapi = json_decode($curl->get('https://api.msdnxz.com/?s=App.Key.Verify&thekey='.$key));
2.验证通过后调用数据库完整信息
200 success
access-control-allow-origin: *
cache-control: no-store, no-cache, must-revalidate
content-type: application/json;charset=utf-8
date: Fri, 01 Oct 2021 07:18:20 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
pragma: no-cache
server: nginx
strict-transport-security: max-age=31536000
{
"ret": 200,
"data": {
"message": "查询成功",
"phone": "13688805189",
"phonediqu": "广东深圳 移动",
"lol": "没有找到",
"wb": "没有找到",
"qq": "10001",
"qqlm": "8237768ad98104287f6ebf736748a484",
"name": "没有找到",
"sfz": "没有找到",
"dz": "没有找到",
"key_number": 47
},
"msg": ""
}
3.验证未通过调用提示信息
200 success
access-control-allow-origin: *
cache-control: no-store, no-cache, must-revalidate
content-type: application/json;charset=utf-8
date: Fri, 01 Oct 2021 07:17:07 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
pragma: no-cache
server: nginx
strict-transport-security: max-age=31536000
{
"ret": 200,
"data": {
"message": "查询成功",
"phone": "请获取授权",
"phonediqu": "请获取授权",
"lol": "请获取授权",
"wb": "请获取授权",
"qq": "请获取授权",
"qqlm": "请获取授权",
"name": "请获取授权",
"sfz": "请获取授权",
"dz": "请获取授权",
"key_number": -1
},
"msg": ""
}
解决方案:
1.更换ssl证书
获取证书的渠道很多,免费的一般可使用1年,比如阿里云、腾讯云都有提供。
2.跳过ssl证书验证
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|