接口文档地址:https://www.mysubmail.com/documents
$url = 'https://api-v4.mysubmail.com/sms/xsend';//接口地址 $appId = 'XXX';//APPID $appkey = 'XXX';//APPKEY $phone = 'XXX';//发送手机号 $project = 'XXX';//模板ID $data = [ 'appid' => $appId, 'to' => $phone, 'timestamp' => time(), 'sign_type' => 'md5', 'sign_version' => 2, 'project' => $project ]; ksort($data); $signature = $appId . $appkey . http_build_query($data) . $appId . $appkey; $data['signature'] = md5($signature);//数字签名 $vars = [ 'code' => 'XXX', ]; $data['vars'] = json_encode($vars);//文本变量 $client = new Client(); $response = $client->createRequest() ->setMethod('POST') ->setUrl($url) ->setData($data) ->setHeaders([ 'Content-Type'=>'application/json', ]) ->setFormat(Client::FORMAT_JSON) //提交的数据的格式 ->send();
如上可以实现给指定手机号发送指定模板的通知内容,其他方式可参照文档实现
更多关于PHP赛邮SUBMAIL短信通知的资料请关注插件窝其它相关文章!