Explain the Send SMS using PHP Codeigniter

In this tutorial, you’ll learn how to send a message to a mobile using PHP code.

Controller Code

public function sendSmsAmd()
{
    $toMobile='XXXXXXXXXX';

    $msg='SMS Message Testing ';
    $user = "amd@XXX.in";               
    $apikey = "XXXXXXx";  
    $sender_id = "CODEONE";                                                            
    $route = "4";                                                                                               
    $postData = array(                                        
    "user" => $user,     
    "apikey" => $apikey,                    
    "route" => $route,            
    "sender_id" => $sender_id,
    "mobile" => $toMobile,                         
    "message" => $msg,                                                                       
    "filterdups" => TRUE             
    );               
    $clientUrl = "https://www.smsgrid.com/send_sms.php";
    $ch = curl_init($clientUrl);    
    curl_setopt($ch, CURLOPT_POST, 1);///NKAdded      
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);        
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    $jresp = curl_exec($ch);   

    print_r($jresp);

    curl_close($ch);  



}

Leave a Reply

Your email address will not be published. Required fields are marked *