使用给华为云 消息
服务 API 方式发送短信
代码来自华为云,已通过测试
<?php
/**
* 华为云发送短信示例代码
* 本段代码需要使用自己的配置信息才能正常运行,出配置信息外,不需要改动任何代码内容即可运行
*
* @version 0.1
* @author huawei cloud(https://support.huaweicloud.com/devg-msgsms/sms_04_0003.html)
*
* 2019-03-05 IIS10 + PHP 7.2.5调试通过
*/
//
// 为避免误调用而加入的提示,测试&部署时需移除本段代码
//
$tips = array(
"code"=>"200",
"msg"=>"Config ur info first",
"time"=>date("h:i:sa")
);
die(json_encode($tips));
//必填,请参考"开发准备"获取如下数据,替换为实际值
$url = 'https://api.rtc.huaweicloud.com:10443/sms/batchSendSms/v1'; //APP接入地址+接口访问URI
$APP_KEY = ''; //APP_Key
$APP_SECRET = ''; //APP_Secret
$sender = ''; //国内短信