当前位置:网站首页>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://blog.csdn.net/qq_41408081/article/details/124309075
边栏推荐
- Is CICC fortune a state-owned enterprise and is it safe to open an account
- 【ValueError: math domain error】
- 中金财富是国企吗,开户安全吗
- How to initialize "naming and surname" in C language
- Cc2541 emulator CC debugger tutorial
- 【汇编语言】从最底层的角度理解“堆栈”
- Numerical remapping method (remap)
- What business scenarios will the BGP server be used in?
- 2018 China Collegiate Programming Contest - Guilin Site J. stone game
- 89 logistic回歸用戶畫像用戶響應度預測
猜你喜欢

Wechat public platform test number application, authorized login function and single sign on using hbuilder X and wechat developer tools

Is it better to use a physical machine or a virtual machine to build a website?

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

Campus transfer second-hand market source code

How to "gracefully" measure system performance

What should I pay attention to when using proxy IP?

Shardingsphere introduction and sub table usage

一些使用代理IP的小技巧。

搭建网站是用物理机还是云主机好?

How to classify proxy IP?
随机推荐
php 2022年4月20面试题整理
Use of j-link RTT
easyswoole环境配置
Today will finally write system out. Println()
Analyze the three functions of static proxy IP.
Lane cross domain problem
Wechat public platform test number application, authorized login function and single sign on using hbuilder X and wechat developer tools
搭建网站是用物理机还是云主机好?
What is a makefile file?
leetcode:27. 移除元素【count remove小操作】
假如404页面是这样的 | 每日趣闻
有哪些业务会用到物理服务器?
What is BGP server and what are its advantages?
App optimization and advanced scoreboard Part 2 [Mui + flask + mongodb]
一些使用代理IP的小技巧。
配置iptables实现本地端口转发的方法详解
2022.4.20-----leetcode. three hundred and eighty-eight
如何选择一台好的拨号服务器?
有哪些常见的代理ip问题?
A simple and open source navigation website source code