当前位置:网站首页>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
边栏推荐
- 89 logistic regression user portrait user response prediction
- 013_基于Session实现短信验证码登录流程分析
- [leetcode daily question] 396 Rotation function
- Shardingsphere sub database and sub table
- What is a makefile file?
- What is a proxy IP pool and how to build it?
- 每日一题(2022-04-22)——旋转函数
- Under the pressure of sales, domestic mobile phones began to reduce prices, but they haven't put down their final face
- Analyze the advantages and disadvantages of tunnel proxy IP.
- 如何对代理IP进行分类?
猜你喜欢

Shardingsphere sub database and sub table

How does Axure set the content of the text box to the current date when the page is loaded

世界读书日 | 技术人不要错过的好书(IT前沿技术)

ThinkPHP kernel development blind box mall source code v2 0 docking easy payment / Alibaba cloud SMS / qiniu cloud storage

Halo open source project learning (I): project launch

假如404页面是这样的 | 每日趣闻

005_redis_set集合

What are the common proxy IP problems?

Easyswool environment configuration

BGP服务器在什么业务场景会被用到?
随机推荐
013_基于Session实现短信验证码登录流程分析
Makefile文件是什麼?
今天终于会写System.out.println()了
LeetCode 349. Intersection of two arrays (simple, array) Day12
Today will finally write system out. Println()
关于局域网浅谈
一加一为什么等于二
拨号vps会遇到什么问题?
012_ Access denied for user ‘root‘@‘localhost‘ (using password: YES)
What is a dial-up server and what is its use?
How to change the size of SVG pictures without width in openlayer
2022.4.20-----leetcode. three hundred and eighty-eight
OJ daily practice - Finish
有哪些常见的代理ip问题?
openstack 服务的启动
什么是代理IP池,如何构建?
Log4j2 configuration
Leetcode40 - total number of combinations II
用TensorFlow实现线性回归(包括过程中出现的问题及解决方法)
Multithreading technology core