当前位置:网站首页>tp6阿裏雲短信 window 報 cURL error 60: SSL certificate problem: unable to get local issuer certificate
tp6阿裏雲短信 window 報 cURL error 60: SSL certificate problem: unable to get local issuer certificate
2022-04-23 02:07:00 【逸曦穆澤】
序:幫客戶接一個阿裏雲短信驗證碼提醒,新版的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"
版权声明
本文为[逸曦穆澤]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230207164932.html
边栏推荐
猜你喜欢

Shardingsphere broadcast table and binding table

Under the pressure of sales, domestic mobile phones began to reduce prices, but they haven't put down their final face

拨号服务器是什么,有什么用处?

How to choose a good dial-up server?

Lane cross domain problem

【动手学深度学习V2】循环神经网络-1.序列模型

Open3d point cloud processing

简洁开源的一款导航网站源码

什么是bgp服务器,有哪些优势?

006_redis_SortedSet类型
随机推荐
2022.4.22-----leetcode. three hundred and ninety-six
搭建网站是用物理机还是云主机好?
Flink real-time data warehouse project - Design and implementation of DWS layer
动态代理ip的测试步骤有哪些?
Makefile文件是什麼?
Summary of I / O knowledge points
Esp32 message queue using FreeRTOS
LeetCode 447. Number of boomerangs (permutation and combination problem)
2022.4.10-----leetcode. eight hundred and four
JDBC cannot connect to MySQL, and the error is access denied for user 'root' @ '* * *' (using password: Yes)
什么是bgp服务器,有哪些优势?
如何选择一台好的拨号服务器?
Unity editor hierarchy drop-down menu extension
What categories do you need to know before using proxy IP?
What business scenarios will the BGP server be used in?
Network jitter tool clumsy
Echo "new password" |passwd -- stdin user name
Leetcode39 combined sum
openstack 服务的启动
Batch multiple files into one hex