PHP Sample Code (GET)
<?php
$apikey = "ZJN*****vB";
$sender = "Hajana One";
$mobile = "923001234567";
$message = "Test SMS From Hajana One";
//Sending SMS
$url='https://www.hajanaone.com/api/sendsms.php?apikey='.api$key.'&phone='.$mobile.'&sender='.urlencode($sender).'&message='.urlencode($message);
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec ($ch);
echo $result;
?>
PHP Sample Code (POST)
<?php
$user_api = '******';
$number = 923001234567;
$sender = 'Your Mask';
$message = 'Test message from Hajana One';
// sending sms
$base_url = 'http://www.hajanaone.com/api/sendsms.php';
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $base_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"apikey=".$user_api."&phone=".$nums."&sender=".urlencode($sender)."&message=".urlencode($message));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close ($ch);
if (preg_match( "/successfully/", $output )){
echo 'Message Sent Successfully';
}else{
echo 'Message senging failed';
}
?>