Dear Clients! for best customer support dial our customer care helpline number : 0304-111-8003

SMS API Script for DMA Softlab Radius Manager

URL for SSL Supported and Numbers Started with 92:
https://www.hajanaone.com/api/sendsms.php

URL for SSL Supported and Numbers Started with 0:
https://www.hajanaone.com/api/zero.php

URL for Non SSL Support and Numbers Started with 92:
http://www.dma.hajanaone.com/api/sendsms.php

URL for Non SSL Support and Numbers Started with 0:
http://www.dma.hajanaone.com/api/zero.php

Perameter Required Description
apikey Yes User API Key Get from your account Dashboard
sender Yes Registered Mask Name (Sender ID)

PHP Code Sample : Download
    
<?php

/* 
**********************************************************
**    Name     : Javed Hajana
**    Company  : Hajana One Pakistan
**    For Help : [email protected] 
*********************************************************** 
*/

function sendsms($recp, $body, &$errmsg)
{
// enter your Hajana One SMS GATEWAY detail here


$api_key        = "Paste_API_Key_here";                             // Replace Your Hajana One Account API Key.
$api_masking    = "Enter_Your_mask_Name_here";                      // Replace Your Registered/Approved Mask.
$base_url       = "https://www.hajanaone.com/api/sendsms.php";      // Replace Base URL if need witout https of numbers starting with zero.


$api_masking = urlencode($api_masking);
// clean up HTML entities
$body = html_entity_decode($body, ENT_COMPAT, "UTF-8");
// implement your own SMS gateway here
$body = rawurlencode($body);
$ch = curl_init();
// change the IP and id password in the below line to match your local config. Virtual IT Support
curl_setopt($ch, CURLOPT_URL, "$base_url?apikey=$api_key&phone=$recp&sender=$api_masking&message=$body");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Adding 2 seconds delay so that oru mobile SIM may not get blocked
sleep(2);
 
$res = curl_exec($ch);
curl_close($ch);
// uncomment the following line to see the result from the SMS gateway
//  print $res;
// log result
if (substr($res, 0 , 4) == "ERR:")
$res_str = $res;
else
$res_str = "OK";
syslog(LOG_INFO, "[radiusmanager] Sending SMS with 20 sec delay in each SMS added by Virtual IT Support to Mobile No " . $recp . " (" . $res_str . ")");
// error has occured, return FALSE
if (substr($res, 0 , 4) == "ERR:")
{
$errmsg = $res;
return false;
}
// no error, return TRUE
return true;
}

?>