PHP Send SMS (call NetEase cloud Letter implementation)

Source: Internet
Author: User
Call NetEase cloud letter, realize SMS send

NetEase Cloud Letter Send SMS//http://dev.netease.im/docs?doc=server& #发送模板短信 function yx_sendsms ($mobile = ", $params =", $ Templateid= ') {header ("content-type:text/html;        Charset=utf-8 ");        $AppKey = ' xxx ';        $AppSecret = ' xxx ';        $Nonce = rand (100000,999999);        $CurTime = time ();        $CheckSum = Strtolower (SHA1 ($AppSecret. $Nonce. $CurTime));        $url = ' https://api.netease.im/sms/sendtemplate.action ';        $head _arr = Array ();        $head _arr[] = ' content-type:application/x-www-form-urlencoded ';        $head _arr[] = ' charset:utf-8 ';        $head _arr[] = ' AppKey: '. $AppKey;        $head _arr[] = ' Nonce: ' $Nonce;        $head _arr[] = ' curtime: '. $CurTime;        $head _arr[] = ' CheckSum: '. $CheckSum; $data = Array (); $data [' templateid '] = $templateid; $data [' mobiles '] = $mobile; $data [' params '] = $params;//var_dump ($ data); $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, Curlopt_returntransfer, true); Curl_ Setopt ($ch, Curlopt_post, true); curl_setopt ($ch, Curlopt_httpheader, $head _arr) curl_setopt ($ch, Curlopt_postfields, Http_build_query ($data)); Curl_        Setopt ($ch, curlopt_timeout), $result = Curl_exec ($ch); Curl_close ($ch); $resArr = (array) json_decode ($result); $RESARR = (array) json_decode (' {"Code": $, "msg": "Sendid", "obj": 1} ');//var_dump ($RESARR);//echo $resArr [' Code '];    return $RESARR; }

The above describes the PHP send text messages (call NetEase cloud Letter implementation), including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.