//短信讀取接口。
namespaceMoyunSms;
require_once('SmsSenderUtil。php');
classSmsSingleSender{jeecgboot短信接口未配置。
var$url;
var$accesskey;
var$secretkey;特殊短信接口。
var$util;短信接口大全。
function__construct($accesskey,$secretkey){短信hz接口。
$this->url=";
$this->accesskey=$accesskey;短信測壓api接口。
$this->secretkey=$secretkey;短信api。
$this->util=newSmsSenderUtil();/**
*如果有多個簽名,請將其添加到信息內容中,否則系統將使用默認簽名
*@paramint$type短信類型,0是普通短信,1營銷短信怎么根據接口文檔寫接口。
*@paramstring$nationCode例如,86是中國的**碼如何對接接口文檔。
*@paramstring$phoneNumber手機號碼沒有**碼
*@paramstring$msg信息內容必須與申請的模板格式一致,否則將返回錯誤短信接口。
*@paramstring$extend擴展碼,可填空串
*@paramstring$ext服務端返回的原始參數可填空串手機短信接口。
*@returnstringjsonstring{"result":xxxxx,"errmsg":"xxxxxx"。。。},被省略的內容見協議文件functionsend($type,$nationCode,$phoneNumber,$msg,$extend="",$ext="""tel":{短信接口公司。
"nationcode":"86",
"mobile":"""type":0,
"msg":"你的驗證碼是",
"sig":"",手機驗證碼短信接口。
"time":,
"extend":"",
"ext"""“應答包體”result":0,接口文檔怎么看。
"errmsg":"OK",
"ext":"",
"sid":"xxxxxxx",接口文檔是什么。
"fee":1*/
$random=$this->util->getRandom();接口文檔生成工具。
$curTime=time();接口文檔示例。
$wholeUrl=$this->url。"?accesskey="。$this->accesskey。"&random="。$random;接口文檔工具。
///按協議組織post包體
$data=newstdClass();
$tel=newstdClass();接口文檔編寫。
$tel->nationcode=""。$nationCode;
$tel->mobile=""。$phoneNumber;
$data->tel=$tel;
$data->type=(int)$type;
$data->msg=$msg;http接口文檔。
$data->sig=hash("",
"secretkey="。$this->secretkey。"&random="。$random。"&time="。$curTime。"&mobile="。$phoneNumber,FALSE);免費接收短信驗證碼平臺。
$data->time=$curTime;
$data->extend=$extend;
$data->ext=$ext;
return$this->util->sendCurlPost($wholeUrl,$data);/**驗證碼接口。
*單發指定模板手機為什么收不到驗證碼短信。
*@paramstring$nationCode例如,86是中國的**碼短信。
*@paramstring$phoneNumber手機號碼沒有**碼
*@paramint$templId模板id
*@paramarray$params模板{1}等模板參數列表。。。{2}。。。{3},需要帶三個參數
*@paramstring$sign如果填空串,系統將使用默認簽名
*@paramstring$extend擴展碼,可填空串
*@paramstring$ext服務端返回的原始參數可填空串
*@returnstringjsonstring{"result":xxxxx,"errmsg":"xxxxxx"。。。},被省略的內容見協議文件functionsendWithParam($nationCode,$phoneNumber,$templId=0,$params,$sign="",$extend="",$ext="""tel":{短信接口文檔。
"nationcode":"86",
"mobile":"""sign":"Moyun",
"tpl_id":19,
"params":[
“驗證碼”,“四”sig":"",
"time":,
"extend":"",
"ext"""“應答包體”result":0,
"errmsg":"OK",
"ext":"",
"sid":"xxxxxxx",
"fee":1*/
$random=$this->util->getRandom();
$curTime=time();
$wholeUrl=$this->url。"?sdkaccesskey="。$this->accesskey。"&random="。$random;
///按協議組織post包體
$data=newstdClass();
$tel=newstdClass();
$tel->nationcode=""。$nationCode;
$tel->mobile=""。$phoneNumber;
$data->tel=$tel;
$data->sig=$this->util->calculateSigForTempl($this->secretkey,$random,$curTime,$phoneNumber);
$data->tpl_id=$templId;
$data->params=$params;
$data->sign=$sign;
$data->time=$curTime;
$data->extend=$extend;
$data->ext=$ext;
return$this->util->sendCurlPost($wholeUrl,$data);classSmsMultiSender{
var$url;
var$accesskey;
var$secretkey;
var$util;
function__construct($accesskey,$secretkey){
$this->url=";
$this->accesskey=$accesskey;
$this->secretkey=$secretkey;
$this->util=newSmsSenderUtil();/**
*如果有多個簽名,請以[]的形式將其添加到信息內容中,否則系統將使用默認簽名
*[注]海外短信無群發功能
*@paramint$type短信類型,0是普通短信,1營銷短信
*@paramstring$nationCode例如,86是中國的**碼
*@paramstring$phoneNumbers沒有**碼的手機號列表
*@paramstring$msg信息內容必須與申請的模板格式一致,否則將返回錯誤
*@paramstring$extend擴展碼,可填空串
*@paramstring$ext服務端返回的原始參數可填空串
*@returnstringjsonstring{"result":xxxxx,"errmsg":"xxxxxx"。。。},被省略的內容見協議文件functionsend($type,$nationCode,$phoneNumbers,$msg,$extend="",$ext="""tel":["nationcode":"86",
"mobile":""{
"nationcode":"86",
"mobile"""""
"type":0,
"msg":"你的驗證碼是",
"sig":"",
"time":,
"extend":"",
"ext"""“應答包體”result":0,
"errmsg":"OK",
"ext":"",
"detail":["result":0,
"errmsg":"OK",
"mobile":"",
"nationcode":"86",
"sid":"xxxxxxx",
"fee":1{
"result":0,
"errmsg":"OK",
"mobile":"",
"nationcode":"86",
"sid":"xxxxxxx",
"fee":1}$random=$this->util->getRandom();
$curTime=time();
$wholeUrl=$this->url。"?accesskey="。$this->accesskey。"&random="。$random;
$data=newstdClass();
$data->tel=$this->util->phoneNumbersToArray($nationCode,$phoneNumbers);
$data->type=$type;
$data->msg=$msg;
$data->sig=$this->util->calculateSig($this->secretkey,$random,$curTime,$phoneNumbers);
$data->time=$curTime;
$data->extend=$extend;
$data->ext=$ext;
return$this->util->sendCurlPost($wholeUrl,$data);/**
*指定模板群發
*[注]海外短信無群發功能
*@paramstring$nationCode例如,86是中國的**碼
*@paramarray$phoneNumbers沒有**碼的手機號列表
*@paramint$templId模板id
*@paramarray$params模板{1}等模板參數列表。。。{2}。。。{3},需要帶三個參數
*@paramstring$sign如果填空串,系統將使用默認簽名
*@paramstring$extend擴展碼,可填空串
*@paramstring$ext服務端返回的原始參數可填空串
*@returnstringjsonstring{"result":xxxxx,"errmsg":"xxxxxx"。。。},被省略的內容見協議文件functionsendWithParam($nationCode,$phoneNumbers,$templId,$params,$sign="",$extend="",$ext="""tel":["nationcode":"86",
"mobile":""{
"nationcode":"86",
"mobile"""""
"sign":"Moyun",
"tpl_id":19,
"params":[
“驗證碼”,“四”sig":"",
"time":,
"extend":"",
"ext"""“應答包體”result":0,
"errmsg":"OK",
"ext":"",
"detail":["result":0,
"errmsg":"OK",
"mobile":"",
"nationcode":"86",
"sid":"xxxxxxx",
"fee":1{
"result":0,
"errmsg":"OK",
"mobile":"",
"nationcode":"86",
"sid":"xxxxxxx",
"fee":1}$random=$this->util->getRandom();
$curTime=time();
$wholeUrl=$this->url。"?accesskey="。$this->accesskey。"&random="。$random;
$data=newstdClass();
$data->tel=$this->util->phoneNumbersToArray($nationCode,$phoneNumbers);
$data->sign=$sign;
$data->tpl_id=$templId;
$data->params=$params;
$data->sig=$this->util->calculateSigForTemplAndPhoneNumbers(
$this->secretkey,$random,$curTime,$phoneNumbers);
$data->time=$curTime;
$data->extend=$extend;
$data->ext=$ext;
return$this->util->sendCurlPost($wholeUrl,$data);
中企動力是一家專業的網絡推廣公司,我們擁有豐富的網絡推廣經驗和專業的團隊,能夠為企業提供全方位的網絡推廣服務。我們為企業提供網站建設、網站優化、平臺推廣等服務,幫中企動力業在網絡上提升知名度、擴大影響力、提升銷售額。如果您有網絡推廣的需求,歡迎聯系中企動力加微信:CE4006608066,我們將竭誠為您服務。