Monday, November 19, 2018

sms gatway integration code

CONS SMS_USER = 'UserName';
CONS SMS_PASS = 'P@nrb';
CONS SMS_HOST = 'http://sms.sslwireless.com/pushapi/dynamic/server.php';
$phone = '88' . $phone;
$text = 'You have ' . $total . ' new Tenders of your preferred area. For details, please check your email or visit agent result at http://bdtender.com. Helpline: 01789-772266';

$params = 'user=' . self::SMS_USER . '&pass=' . self::SMS_PASS . '&sms[0][0]=' . $phone . '&sms[0][1]=' . urlencode($text) . '&sms[0][2]=880123456789&sid=bdtender';

$ch = curl_init(self::SMS_HOST);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);

$response = curl_exec($ch);
curl_close($ch);

return $response;