Example 1 - Sending SMS using GET method.
<?php
$params = array(
'username' => 'username', //username used in HQSMS
'password' => md5('password'),
'to' => '44123123123', //destination number
'from' => "HQSMS.com", //sender name have to be activated
'message' => "content of message",
);
if ($params['username'] && $params['password'] && $params['to'] && $params['message']) {
$data = '?'.http_build_query($params);
$file = fopen('https://ssl.hqsms.com/sms.do'.$data,'r');
$result = fread($file,1024);
fclose($file);
echo $result;
}
?>
Example 2 - Sending SMS using POST method.
<?php
$username = 'login'; //username used in HQSMS
$password = md5('password');
$to = '44123123123'; //destination number
$from = urlencode("HQSMS.com"); //sender name have to be activated
$message = urlencode("Message content");
$url = 'https://ssl.hqsms.com/sms.do';
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, 'username='.$username.'&password='.$password.'&from='.$from.'&to='.$to.'&message='.$message);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec ($c);
curl_close ($c);
echo $content;
?>
