PHP示例SMS代码-消息传递API

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP示例SMS代码-消息传递API相关的知识,希望对你有一定的参考价值。

BroadNet Technologies furnishes you with a variety of php Sample SMS code examples and programming objects, and assist you in connecting to our gateway via the PHP script. Sending your messages via our designed PHP SMS Sample Code is easier than you guess!
  1. //PHP SMS API integration code
  2. //Your application url
  3. $ApiUrl ="ApiUrl";)
  4.  
  5. //Your User Id
  6. $user ="user";
  7.  
  8. //Your password
  9. $pass ="****";
  10.  
  11. //Multiple mobiles numbers separated by comma
  12. $mno = "9999999";
  13.  
  14. //Sender ID,While using route4 sender id should be 6 characters long.
  15. $sid = "102234";
  16.  
  17. //Your message to send, Add URL encoding here.
  18. $text = "Test message";
  19.  
  20. // Message Type (1,2,3,4) 1- English,2-Unicode,3- Special Character,4-Arabic
  21. $type = "type";
  22.  
  23. //Prepare parameter string
  24. $url = "$ApiUrl?user=$user&pass=$pass&sid=$sid&mno=$mno&text=$text&type=$type";
  25.  
  26. //prepare connection
  27. $ch = curl_init($url);
  28. curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
  29. curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
  30.  
  31. //reading response
  32. $body = curl_exec($ch);
  33.  
  34. //finally close connection
  35.  
  36. //print response
  37. echo $body;

以上是关于PHP示例SMS代码-消息传递API的主要内容,如果未能解决你的问题,请参考以下文章

PHP必用代码片段

企业信使短信接口API代码示例

Android SMS Verification API 结果码始终为 0

56个PHP开发常用代码

发送带有 php 链接的短信

使用 PHP 的 Google 云消息传递 (GCM)