#Send sms from website in php
public function send_text_message($sms_type = '', $to = "", $replace = array()) {
$sms_info = sms data;
if ((isset($sms_info['username']) && $sms_info['username'] != '') && (isset($sms_info['api_pwd']) && $sms_info['api_pwd'] != ''))
{
$api_username = $sms_info['username'];
$api_userpwd = $sms_info['api_pwd'];
$send_id = SMS_SEND_ID;
$curl = "http://bhashsms.com/api/sendmsg.php";
$msg = getField('message', 'sms_template', '', '', array('type' => $sms_type, 'status' => 'Y'));
foreach ($replace as $key => $value) {
$msg = str_replace($key, $value, $msg);
}
$message = urlencode($msg);
$api_url = $curl . '?' . "user=$api_username&pass=$api_userpwd&sender=$send_id&phone=$to&text=$message&priority=ndnd&stype=normal";
$sms = curl_init($api_url);
ob_start();
$ex = curl_exec($sms);
ob_end_clean();
curl_close($sms);
return $ex;
}
}
//now call the function
send_text_message('X','xyz.x.com',array('a'=>'sss') );