Bulk SMS PHP API to send SMS via PHP API code

Along with developer and technocrats, you can also do API Integration into your software easily.

With the help of ready to use Bulk SMS PHP API  and source code, you can send information in few Minutes. We have ready PHP code for all kind of customer’s requirement like –

1. Send SMS HTTP PHP source code or API – Send single number or less than 100-200 numbers with same content.

2. Bulk SMS XML PHP source code or API – Send more than 200 numbers in a single click with same content.

3. JSON PHP source code or Send SMS API – Send more than 200 numbers in single click with different content.

The Web based  Bulk SMS software enables to take any of API that belongs to its software.

PHP HTTP Send SMS API is here for HTTP users →

http://msg.msgclub.net/rest/services/sendSMS/sendGroupSms?AUTH_KEY=YourAuthKey&message=message&senderId=dddddd&routeId=1&mobileNos=9999999999&smsContentType=english

PHP Sample API code in HTTP →

<?php

function sendsmsGET($mobileNumber,$senderId,$routeId,$message,$serverUrl,$authKey)

{
   $getData = 'mobileNos='.$mobileNumber.'&message='.urlencode($message).'&senderId='.$senderId.'&routeId='.

$routeId;

  //API URL

 $url="http://".$serverUrl."/rest/services/sendSMS/sendGroupSms?AUTH_KEY=".$authKey."&".$getData;

   // init the resource

   $ch = curl_init();
   curl_setopt_array($ch, array(

       CURLOPT_URL => $url,
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_SSL_VERIFYHOST => 0,
       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);
   return $output;

}

function sendsmsPOST($mobileNumber,$senderId,$routeId,$message,$serverUrl,$authKey)

{
  
   //Prepare you post parameters

   $postData = array(   
     
       'mobileNumbers' => $mobileNumber,       
       'smsContent' => $message,
       'senderId' => $senderId,
       'routeId' => $routeId,       
       "smsContentType" =>'english'
   );

   $data_json = json_encode($postData);
   $url="http://".$serverUrl."/rest/services/sendSMS/sendGroupSms?AUTH_KEY=".$authKey;

   // init the resource

   $ch = curl_init();

   curl_setopt_array($ch, array(
       CURLOPT_URL => $url,
       CURLOPT_HTTPHEADER => array('Content-Type: application/json','Content-Length: ' . strlen($data_json)),

       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_POST => true,
       CURLOPT_POSTFIELDS => $data_json,
       CURLOPT_SSL_VERIFYHOST => 0,
       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);
   return $output;
}

?>

PHP XML Bulk SMS API is here for XML users →

http://msg.msgclub.net/rest/services/sendSMS/sendGroupSmsXmlApi

 <Sms>
<AUTH_KEY>yourAuthKey</AUTH_KEY>
<smsContent>hello how are you</smsContent>
<senderId>SMSTST</senderId>
<routeId>2</routeId>
<mobileNumbers>8888888888,9999999999</mobileNumbers>
<smsContentType>english</smsContentType>
<groupName>nid,a,groupA</groupName>
<signature>abcde</signature>
<scheduleddate>12/05/2015 12:00</scheduleddate>                                                            
</Sms>  

PHP Sample  API code in XML  

<?php

function sendsmsGET($mobileNumber,$senderId,$routeId,$message,$serverUrl,$authKey)
{
   $getData = ‘mobileNos=’.$mobileNumber.’&message=’.urlencode($message).’&senderId=’.$senderId.’&routeId=’.
$routeId;

   //API URL
   $url=”http://”.$serverUrl.”/rest/services/sendSMS/sendGroupSms?AUTH_KEY=”.$authKey.”&”.$getData;


   // init the resource
   $ch = curl_init();
   curl_setopt_array($ch, array(
       CURLOPT_URL => $url,
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_SSL_VERIFYHOST => 0,
       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);
   return $output;
}

function sendsmsPOST($mobileNumber,$senderId,$routeId,$message,$serverUrl,$authKey)
{

 
   //Prepare you post parameters
   $postData = array(      
   
       ‘mobileNumbers’ => $mobileNumber,        
       ‘smsContent’ => $message,
       ‘senderId’ => $senderId,
       ‘routeId’ => $routeId,       
       “smsContentType” =>’english’
   );

   $data_json = json_encode($postData);
   $url=”http://”.$serverUrl.”/rest/services/sendSMS/sendGroupSms?AUTH_KEY=”.$authKey;

   // init the resource
   $ch = curl_init();

   curl_setopt_array($ch, array(
       CURLOPT_URL => $url,
       CURLOPT_HTTPHEADER => array(‘Content-Type: application/json’,’Content-Length: ‘ . strlen($data_json)),
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_POST => true,
       CURLOPT_POSTFIELDS => $data_json,
       CURLOPT_SSL_VERIFYHOST => 0,
       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);
   return $output;
}

?>

PHP JSON  Bulk SMS API is here use →

http://msg.msgclub.net/rest/services/sendSMS/sendGroupSms?AUTH_KEY=YourAuthKey

English –
{“smsContent“:”Hello Test SMS”,”groupId“:”0″,”routeId“:”1″,”mobileNumbers“:”9999999999″,”senderId“:
“SMSTST”,”signature“:”signature”,”smsContentType“:”english”}

Unicode –
{“smsContent“:”हैलो टेस्ट एसएमएस”,”groupId“:”0″,”routeId“:”1″,”mobileNumbers“:”9999999999″,”senderId“:
“SMSTST”,”signature“:”signature”,”smsContentType“:”unicode”},”

PHP Sample API code in JSON 

<?php

function sendsmsGET($mobileNumber,$senderId,$routeId,$message,$serverUrl,$authKey)
{
    $getData = ‘mobileNos=’.$mobileNumber.’&message=’.urlencode($message).’&senderId=’.$senderId.’&routeId=’.
$routeId;

    //API URL
    $url=”http://”.$serverUrl.”/rest/services/sendSMS/sendGroupSms?AUTH_KEY=”.$authKey.”&”.$getData;

    // init the resource
    $ch = curl_init();
    curl_setopt_array($ch, array(
       CURLOPT_URL => $url,
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_SSL_VERIFYHOST => 0,
       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);
    return $output;
}

function sendsmsPOST($mobileNumber,$senderId,$routeId,$message,$serverUrl,$authKey)
{
  
    //Prepare you post parameters
    $postData = array(
          
       ‘mobileNumbers’ => $mobileNumber,       
       ‘smsContent’ => $message,
       ‘senderId’ => $senderId,
       ‘routeId’ => $routeId,      
       “smsContentType” =>’english
    );

    $data_json = json_encode($postData);
    $url=”http://”.$serverUrl.”/rest/services/sendSMS/sendGroupSms?AUTH_KEY=”.$authKey;

    // init the resource
    $ch = curl_init();
  
    curl_setopt_array($ch, array(
       CURLOPT_URL => $url,
       CURLOPT_HTTPHEADER => array(‘Content-Type: application/json’,’Content-Length: ‘ . strlen($data_json)),
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_POST => true,
       CURLOPT_POSTFIELDS => $data_json,
       CURLOPT_SSL_VERIFYHOST => 0,
       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);
    return $output;
}
?>

Just Integrate API easily into any software. We offer these Send SMS API in PHP in free of cost to Send SMS directly from website or software. Only you have to pay the small amount for the send SMS services. For more details, you can Contact us.

To get more services check our website now.