40 likes | 254 Views
Integrate Bulk SMS gateway API on your website by adding PHP Script in the website’s code. Here, is the example of msg91.com showing PHP API code how Bulk SMS API help in to sending automatic promotional or transactional bulk SMS. By just integrating simple PHP code.
E N D
Send Bulk SMS using PHP Script Bulk SMS service gives idiosyncratic opportunities to e-commerce industry. Bulk SMS is considered as the most affordable and strong mobile marketing tool, which improve E-commerce conversions over time. Bulk SMS, is the best way to register your presence in your customer’s life, which can bridge customer service offerings with SMS technology. Sometimes in the E-commerce industry people find it inconvenient to send SMS but technology has made it easier with automated Bulk SMS services. Yes, Bulk SMS Gateway API offers automated services through which SMS automatically reaches your customers with SMS gateway. To integrate the API in your E-commerce website you just have to add a PHP script in your website’s code. Below mentioned PHP function can help you to integrate Bulk SMS API in your E-commerce portal. Almost all bulk SMS service providers offer SMS API in different languages like PHP, JAVA, Python, etc. Below we have mentioned PHP function where I am using MSG91 a renowned Bulk SMS Service Provider as SMS gateway. In which you just have to set standard inputs that an SMS will contain. function send_sms($mobile,$msg) { $authKey = "XXXXXXXXXXX"; date_default_timezone_set("Asia/Kolkata"); $date = strftime("%Y-%m-%d %H:%M:%S"); //Multiple mobiles numbers separated by comma $mobileNumber = $mobile; //Sender ID,While using route4 sender id should be 6 characters long. $senderId = "IKOONK"; //Your message to send, Add URL encoding here. $message = urlencode($msg); //Define route $route = "template"; //Prepare you post parameters $postData = array( 'authkey' => $authKey, 'mobiles' => $mobileNumber, 'message' => $message, 'sender' => $senderId, 'route' => $route ); //API URL $url="https://control.msg91.com/sendhttp.php"; // init the resource $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData //,CURLOPT_FOLLOWLOCATION => true )); //Ignore SSL certificate verification curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); //get response $output = curl_exec($ch); //Print error if any if(curl_errno($ch)) { echo 'error:' . curl_error($ch); } curl_close($ch); } Here, you would see two highlighted lines. In the first highlighted line you need to enter your passkey and on the second you need to enter the sender ID in the promotional or Transactional Bulk SMS. And while entering mobile number you need to enter country specified code (For example, USA’s country code is 1. India’s country code is 91). Syntax: <?php $message = "Hello World"; $mobile = "9188*******"; send_sms($mobile,$message); ?>