SMS

SMS

PHP

PHP sample code to use Reson8 SMS API

Send an SMS message using Reson8 with PHP

function SendSMS($api_url, $username, $password, $msg_body, $msg_encoding, $country_code, $area_code, $recipients, $msg_header) { 

$data="SenderName=$username&Password=$password&MessageBody=$msg_body&Encoding=$msg_encoding&CountryCode=$country_code&AreaCode=$area_code&MessageRecipients=$recipients&MCC=&MNC=&MsgHeader=$msg_header";

$params = array('http' => array(
            'method' => 'POST',
            'content' => $data
          ));

$ctx = stream_context_create($params); $fp = @fopen($api_url, 'rb', false, $ctx);

 if (!$fp) {     
    throw new Exception("Problem with $api_url, $php_errormsg");
}
    
$response = @stream_get_contents($fp); 

if ($response === false) {     
    throw new Exception("Problem reading data from $api_url, $php_errormsg"); 
}
 
return $response; 

}