首页 > 其他分享 >cURL error 60: SSL certificate problem: unable to get local issuer certificate

cURL error 60: SSL certificate problem: unable to get local issuer certificate

时间:2024-04-01 19:33:17浏览次数:26  
标签:code return certificate get mobile 60 unable issuer

阿里云短信 window 报 cURL error 60: SSL certificate problem: unable to get local issuer certificate

原文链接:https://blog.csdn.net/qq_41408081/article/details/124309075

序:帮客户接一个阿里云短信验证码提醒,新版的SDK,一下,折磨简单,在Windows上搞的差点心力交瘁,差点怀疑自己了,还好,收工下班

代码:

// 阿里云短信
public static function createClient($accessKeyId, $accessKeySecret){
$config = new Config([
"accessKeyId" => $accessKeyId,
"accessKeySecret" => $accessKeySecret
]);
// 访问的域名
$config -> endpoint = "dysmsapi.aliyuncs.com";
return new Dysmsapi($config);
}
public static function smsTemp($mobile,$code){
$client = self::createClient(SMS_ID,SMS_SECRET);
$sendSmsRequest = new SendSmsRequest([
"signName" => SIGN_NAME,
"templateCode" => SMS_CODE,
"phoneNumbers" => $mobile,
"templateParam" => "{\"code\":\"$code\"}"
]);
// 复制代码运行请自行打印 API 的返回值
return $client->sendSms($sendSmsRequest);
}
// 测试 API
public function test($mobile,$code){
$res = self::smsTemp($mobile,$code);
if($res->body->code == "OK") {
return "success";
}
return 'fail';
}

  


CA证书,用来在调用HTTPS资源的时候,验证对方网站是否是CA颁布的证书,而不是自己随便生成的;

1、需要下载CA证书 文件地址是 http://curl.haxx.se/ca/cacert.pem

2、将之放到php目录下,并在php.ini 中的 curl.cainfo 后添加路径 :

curl.cainfo="D:\php\cacert.pem"
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/qq_41408081/article/details/124309075

标签:code,return,certificate,get,mobile,60,unable,issuer
From: https://www.cnblogs.com/smilevv/p/18109228

相关文章