the implementation method of sending text messages by PHP in the Cloud Slice network interface
Cloud Mesh Send SMS
/** * [sendsms description] * @param [string] $tpl _content [SMS content sent] * @param $send _mobile [sent mobile phone number] */publi C function Sendsms ($tpl _content, $send _mobile) {$this->yunpian_appkey = env (' Yunpian_appkey ');//Cloud Slice account Appkey $this ->yunpian_secret = env (' yunpiansecretxyz ');//Cloud Slice account Secret//initialization $ch = Curl_init (); $data =array (' text ' = = $tpl _content, ' apikey ' + $this->yunpian_appkey, ' mobile ' = $send _mobile); curl_setopt ($ch, Curlopt_url, ' Https://sms.yunpian.com/v2/sms/single_send.json '); curl_setopt ($ch, Curlopt_postfields, Http_build_query ($data)); curl_setopt ($ch, Curlopt_httpheader, Array (' Accept:text/plain;charset=utf-8 ', ' content-type:application/ X-www-form-urlencoded ', ' charset=utf-8 ')); curl_setopt ($ch, Curlopt_returntransfer, true); curl_setopt ($ch, Curlopt_timeout, 10); curl_setopt ($ch, Curlopt_post, 1); curl_setopt ($ch, Curlopt_ssl_verifypeer, false); curl_setopt ($ch, Curlopt_postfields, Http_build_query ($data)); $senD_data = curl_exec ($ch); Curl_close ($ch); Parse the returned result (JSON format string) $backmassage = Json_decode ($send _data,true); Echo ' $backmassage '; This is written in the job, so I remember a log can be ignored! Log::info (' Smsmessagelog: '. $send _data); return [$backmassage, $send _data]; }