How to send SMS from mysmsmantra using php?
I have purchased API from smsmantra.Can anyone tell me how to integrate this in website.My web application is in PHP language.
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
Here is the code.It’s working for me.Hope it will help you.
<?php if ($_REQUEST['smsnumber'] != "") {
$company_data['sms_text']="This is for testing purpose";
$TID="TXN".rand();
$number = $_REQUEST['smsnumber'];
$text = "Dear Customer, The TXN for ID No. " . $TID . " is Accepted, " . $company_data['sms_text'] . 'Thanks.';
$url = 'http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp';
$fields = array(
'username' => 'xxxxxxx',
'password' => 'xxxxxxxx',
'sendername' => 'XXXXXX',
'mobileno' => $number,
'message' => $text
);
foreach($fields as $key => $value) {
$fields_string.= $key . '=' . $value . '&';
}
rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
$result = curl_exec($ch);
curl_close($ch);
?>