Php calls the cloud film network interface to send short messages,
How php calls the cloud film network interface to send Short Messages
Cloud film Network sends text messages
/*** [SendSms description] * @ param [string] $ tpl_content [text message content sent] * @ param $ send_mobile [sent mobile phone number] */public function SendSms ($ tpl_content, $ send_mobile) {$ this-> yunpian_appkey = env ('yunpian _ appkey'); // cloud account appkey $ this-> yunpian_secret = env ('yunpiansecretxy '); // cloud account secret // initialization $ ch = curl_init (); $ data = array ('text' => $ tpl_content, 'apikey' => $ this-> yunpian_appkey, 'mobile' => $ send_mobile); curl_seto Pt ($ ch, CURLOPT_URL, 'https: // scheme); 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 results (json string) $ backmassage = json_decode ($ send_data, true); echo '$ backmassage '; // This is written in the job, so you can ignore a log! Log: info ('smessagelog: '. $ send_data); return [$ backmassage, $ send_data];}
Cloud SMS interface documentation: http://www.yunpian.com/api2.0/api-domestic/single_send.html
If you have any questions, please leave a message or go to the community on this site for discussion. Thank you for reading this article. Thank you for your support!