Posted By

Broadnet on 07/18/17


Tagged

php code api sample sms messaging


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

NicolausX


Example of PHP Sample SMS code - Messaging API


 / Published in: PHP
 

URL: https://broadnet.me/developer-tools/sms-sample-code/php-sample-code-sms.html

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. curl_close($ch);
  36.  
  37. //print response
  38. echo $body;

Report this snippet  

You need to login to post a comment.