Untitled Page

Send SMS Gateway API – PHP

This command can be used to send text messages to either individual numbers or entire contact groups.

Sample Request

                
  1. <?php
  2. include "getpost-lib.php";
  3. $name = $_REQUEST["name"];
  4. $message = $_REQUEST["message"];
  5. $mobileNumber=$_REQUEST["number"];
  6. $email=$_REQUEST["email"];
  7. $message="Hi ".$name." we received your request. from number is: ".$mobileNumber." and from email ".$email;
  8. $senderId="sender";
  9. $serverUrl="serverUrl";
  10. $authKey="yourAuthkey";
  11. $route="1";
  12. echo sendsmsGET($mobileNumber,$senderId,$route,$message,$serverUrl,$authKey);
  13. ?>
                    
  1. <?php
  2. include "getpost-lib.php";
  3. $name = $_REQUEST["name"];
  4. $message = $_REQUEST["message"];
  5. $mobileNumber=$_REQUEST["number"];
  6. $email=$_REQUEST["email"];
  7. $message="Hi ".$name." we received your request. from number is: ".$mobileNumber." and from email ".$email;
  8. $senderId="sender";
  9. $route="1";
  10. $serverUrl="serverUrl";
  11. $authKey="yourAuthkey";
  12. echo sendsmsPOST($mobileNumber,$senderId,$route,$message,$serverUrl,$authKey);
  13. ?>
                    
  1. <?php
  2. function sendsmsGET($mobileNumber,$senderId,$route,$message,$serverUrl,$authKey)
  3. {
  4. $getData = 'authkey=' .$authKey.'&mobileNos='.$mobileNumber.'&message='.urlencode($message).'&senderId='.$senderId.'&route='.$route;
  5. //API URL
  6. $url="http://".$serverUrl."/rest/services/sendSMS/sendGroupSms?AUTH_KEY=".$authKey."&"3.$getData;
  7. // init the resource
  8. $ch = curl_init();
  9. curl_setopt_array($ch, array(
  10. CURLOPT_URL => $url,
  11. CURLOPT_RETURNTRANSFER => true,
  12. CURLOPT_SSL_VERIFYHOST => 0,
  13. CURLOPT_SSL_VERIFYPEER => 0
  14. ));
  15. //get response
  16. $output = curl_exec($ch);
  17. //Print error if any
  18. if(curl_errno($ch))
  19. {
  20. echo 'error:' . curl_error($ch);
  21. }
  22. curl_close($ch);
  23. return $output;
  24. }
  25. function sendsmsPOST($mobileNumber,$senderId,$route,$message,$serverUrl,$authKey)
  26. {
  27. //Prepare you post parameters
  28. $postData = array(
  29. 'authkey' => $authKey,
  30. 'mobileNumbers' => $mobileNumber,
  31. "groupId" => "0",
  32. 'smsContent' => $message,
  33. 'senderId' => $senderId,
  34. 'route' => $route,
  35. "smsContentType" =>'english'
  36. );
  37. $data_json = json_encode($postData);
  38. $url="http://".$serverUrl."/rest/services/sendSMS/sendGroupSms?AUTH_KEY=".$authKey;
  39. // init the resource
  40. $ch = curl_init();
  41. curl_setopt_array($ch, array(
  42. CURLOPT_URL => $url,
  43. CURLOPT_HTTPHEADER => array('Content-Type: application/json','Content-Length: ' . strlen($data_json)),
  44. CURLOPT_RETURNTRANSFER => true,
  45. CURLOPT_POST => true,
  46. CURLOPT_POSTFIELDS => $data_json,
  47. CURLOPT_SSL_VERIFYHOST => 0,
  48. CURLOPT_SSL_VERIFYPEER => 0
  49. ));
  50. //get response
  51. $output = curl_exec($ch);
  52. //Print error if any
  53. if(curl_errno($ch))
  54. {
  55. echo 'error:' . curl_error($ch);
  56. }
  57. curl_close($ch);
  58. return $output;
  59. }
  60. ?>
                    
  1. <?php
  2. define("AUTH_KEY", "1b34cf67c6546ed7734c6aa568d45b0");
  3. function sendsms($mobileNumber,$senderId,$route,$message)
  4. //Your authentication key
  5. $authKey = AUTH_KEY;
  6. $route = "default";
  7. $getData = 'authkey=' .$authKey.'&mobiles='.$mobileNumber.'&message='.$message.'&sender='.$senderId.'&route='.$route;
  8. $url="http://msg.msgclub.net/rest/services/sendSMS/sendGroupSms"."?".$getData;
  9. // init the resource
  10. $ch = curl_init();
  11. curl_setopt_array($ch, array(
  12. CURLOPT_URL => $url,
  13. CURLOPT_RETURNTRANSFER => true,
  14. ));
  15. $output=curl_exec($ch);
  16. curl_close($ch);
  17. return $output;
  18. }
  19. <?>

Caution: Some users opt to place their request inside a code loop, while testing we highly recommend setting the test parameter to true , as occasionally an infinite loop can occur and users can consume all their credits very quickly.

Clients and Folks, who wish to send message through their software and website directly for them sending messages is easiest now. Because you are at right place,No need to develop any application to send and receive messages from your website and software quickly and easily, use Msgclub.net’s Bulk SMS PHP API India and start sending SMS.

With this you can save your time and efforts to a large extend because to integrate this solution into your business or any other system is very easy. Integrate our ready to use Bulk SMS API code in PHP & start sending information through SMS.

We offer the most reliable, powerful and easily adaptable SMS API gateway script for the softwares developed in PHP language. We have ready-to-use API Scripts in PHP language with detailed document to send Bulk SMS in minutes. After that, all you have to do is text directly from your application to send thousands of SMS messages in few minutes and it is easy to get started.

Just create an account and integrate our Bulk SMS API India in few minutes and enjoy our services. We do provide multiple API like Send SMS API in PHP, GetBalance, Add Balance,Scheduled SMS Sending API in PHP, Delivery status SMS API, Send SMS Gateway API PHP.

Whether you are a developer, technocrats or non technocrate, you can integrate PHP SMS API India in any software like Accounting software, CRM Software, Sales Software, HR software, E-commerce websites, E-mail marketing software etc.and send SMS directly from your softwares. Msgclub also allows you to ntegrate BULK SMS PHP API into CRM (Customer relationship software) like Sugar CRM, XRMS, Epesi software etc to send all kind of information to clients.

Various clients are using sms for dues information, billing information, Invoice, renewal of service, total business, to send Tax related, Inventory Management, HR & Payroll information etc and from any of your accounting softwares like webERP accounting & business management, Ino erp, phreedom and many more.

How to integrate bulk sms gateway api in php?

    • Sign up with Msgclub and go to developer tool for PHP Api and follow the simple steps to integrate bulk SMS API in your website. You will get POST and GET both type of send sms PHP API which are ready to use and source code for sms gateway. Our Send sms php script is used by many software companies and startups as sms verification api in India.Our sms api documentation is one of best for sms api for php developers.

      We are sms api providers for sms notification system, signup messages, alert message and verification code using php code. Our developer guide also help our clients sms gateway api integration in php websites or softwares.

      We too provide ready wordpress sms api and drupal sms api for you.

How to send verification code to mobile using php?

    • To send the verification code to mobile through SMS using PHP is possible only with the API Integration.


How can I send bulk sms from my website by integrating sms gateway api in PHP.

    • API is the perfect way to send SMS directly from your application, software or website. As it allows you to integrate SMS services into your own system/application/Website for better functionality.

      URL with some required parameters (User Name, Password, Sender ID, Mobile Number, Message) is a request to the Bulk SMS API is done by calling. When a request is made, the API along with all the parameters send to SMS Gateway server and it process the request and generate response for the particular request immediately. Msgclub gives the best Bulk SMS Gateway with HTTP API (HTTP) to be integrated in different programming language like vb, Java.

Parameter Name with Description

Parameter Name Data Type Description
AUTH_KEY * Alphanumeric Login Authentication Key(This key is unique for every user)
message * Text Enter your message
senderId * Text Enter senderId it should be less then 6 character
routeId * Integer Which route you want use for sending sms enter routeId for particular route.use given Id for route. Transactional Route=1, Promotinal=2, Promotional SenderId=3
mobileNos * Integer Mobile number can be entered with country code or without country code Multiple mobile no. should be separated by comma
groupId * Integer To send sms to particular group enter group name created in MsgClub phone book.
smsContentType* Text "English" for text sms and "Unicode" for Unicode sms

Parameters with( * ) are mandatory.

Note: While both numbers and group_id are optional parameters, one or the other must be included in the request for the message to be sent.

Errors

Error Codes Description
3001 * for Success
3002 * Invalid URL
3003 * Invalid User/Password
3004 * Invalid Message Type
3005 * Invalid Message
3006 * Invalid Destination
3007 * Invalid Source
3008 * Invalid DLR Field
3009 * Authentication Failed
3010 * Internal Error
3011 * Insufficient Balance
3012 * Responce Time Out
3013 * Invalid Request Content Type
3014 * Missing Mobile Number
3015 * SMs Content for Approval
3016 * Missing Required Parameter
3017 * FAIL
3018 * Expired Account
3019 * Null Pointer Exception code
3020 * Empty User Name
3021 * Empty Password
3022 * User Name not Available
3023 * Session Expired
3024 * Already Exist
3025 * Empty Group Name
3026 * Empty Contact Name
3027 * Empty Mobile Number
3028 * Empty Group Id
3029 * Empty City Name
3030 * Empty Occupation
3041 * Empty E-Mail Id
3042 * Group not Exist
3043 * Empty Message
3044 * Empty Route Id
3045 * Empty Sender Id
3047 * Empty Draft Id
3048 * Empty First Name
3049 * Empty Last Name
3050 * Empty Balance
3051 * Empty Role Id
3052 * For User Name Length
3053 * Empty Expiry Date/td>
3054 * Invalid Date
3055 * Empty Client Id
3056 * Invalid Status
3057 * Empty Country Name
3058 * Empty State Name
3059 * Session Expired
3060 * Empty Date
3061 * Access Denied
3062 * Empty Old Password
3063 * Password not Maching
3064 * Empty SMS
3065 * Empty Amount
3066 * Empty Address
3067 * Empty RequestId
3068 * Empty Group and MobileNo
3069 * Empty Description
3070 * Fail to Change RoleId
3071 * Empty CallerId
3072 * Empty File URL and Draft
3073 * Empty Duration
3074 * Invalid Request
3075 * Invalid Aoudio file
3076 * Missing Upload File

Warnings

Warning Codes
3 Invalid number.
For Any Help Call Us Anywhere Anytime On   +91-94068-11127