jiuhcai看了下官方提供的demo,简化了一下,得到了jiuhecai大神修改的秒地云发送手机短信函数:
<?php
function miaodi($dh="",$yzhm=""){
$mdId="此处修给为你自己的";
$mdToken="此处修改为你自己的";
$mbId="你要使用的模板id号,后台可以查到";
if(!$dh){
$url="https://api.miaodiyun.com/20150822/query/accountInfo";
}else{
$url="https://api.miaodiyun.com/20150822/industrySMS/sendSMS";
}
$headers = array('Content-type: application/x-www-form-urlencoded', 'Accept: application/json');
date_default_timezone_set("Asia/Shanghai");
$jhcr['accountSid']=$mdId;
$jhcr['timestamp']=date("YmdHis");
$jhcr['sig'] = md5($mdId . $mdToken . $jhcr['timestamp']);
$jhcr['respDataType']="JSON";
if($dh){
$jhcr['templateid']=$mbId;
$jhcr['to']=$dh;
$jhcr['param']=$yzhm;
}
$con = curl_init();
curl_setopt($con, CURLOPT_URL, $url);
curl_setopt($con, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($con, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($con, CURLOPT_HEADER, 0);
curl_setopt($con, CURLOPT_POST, 1);
curl_setopt($con, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($con, CURLOPT_HTTPHEADER, $headers);
curl_setopt($con, CURLOPT_POSTFIELDS, http_build_query($jhcr));
$result = curl_exec($con);
curl_close($con);
return "".$result;
}
echo miaodi('13935741636','17888');//发送验证码,返回发送结果
// echo miaodi(); //返回账号信息 秒嘀短信平台拥有独立的短信通道,三网合一,致力于为用户提供优质的短信验证码、短信通知、短信群发、语音验证码等服务.秒嘀验证码广泛应用于各行业网站、APP等用户... www.miaodiyun.com/
- 百度快照 - 88%好评
注册现在送10元的红包,能发200条短信,供你测试试用。
|