Aggregate SMS PHP code sample SMS Interface Call Curl method

Source: Internet
Author: User

Aggregated SMS believe that everyone has done, the online code to see the next is too cumbersome, but the online is relatively good, with the Post method, more secure, because our project is on the server request, and bound the white list, so get a simple point of their own use, refer to the following:

<?PHP
$name= "Mr. Zhang";$mobile= "189000000098";$appkey= "A7LK8Y949045699499F07586C";$code= "9999";$tpvalue=UrlEncode("#name #=".$name." & #code #= ".$code);//$url = "http://v.juhe.cn/sms/send?mobile=". $mobile. " &tpl_id=48717&tpl_value=%23name%23%3d ". $name." &key= ". $appkey;$url= "http://v.juhe.cn/sms/send?mobile=".$mobile." &tpl_id=19717&tpl_value= ".$tpvalue." &key= ".$appkey;$content= Sendsms ($url);Var_dump($content);Exit;functionSendsms ($url){ $curl=Curl_init (); curl_setopt ($curl, Curlopt_url,$url); curl_setopt ($curl, curlopt_header,0); curl_setopt ($curl, curlopt_returntransfer,1); $data= Curl_exec ($curl); return $data; Curl_close ();}

When using the variable with the parameter value can be returned to the JSON format, self-processing can be, a simple parameter, two parameters will be the transcoding process of attention to the point is good.

Aggregate SMS PHP code sample SMS Interface Call Curl method

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.