Php calls the cloud film network interface to send short messages,

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.