sparqapi/api/application/helpers/sms_gupshup_helper.php
2019-04-25 19:50:38 +05:30

29 lines
861 B
PHP

<?php
class SMS_GUPSHUP
{
public static function sendSMS($msg,$no)
{
$CI =&get_instance();
$sms_api_url = $CI->config->item('sms_gupshup_url');
$sms_api_url = str_replace('{{sms_api_user_id}}',$CI->config->item('sms_api_user_id'),$sms_api_url);
$sms_api_url = str_replace('{{sms_api_pwd}}',$CI->config->item('sms_api_pwd'),$sms_api_url);
$sms_api_url = str_replace('{{send_to_mobile_no}}',$no,$sms_api_url);
$sms_api_url = str_replace('{{send_msg}}',$msg,$sms_api_url);
// echo $no;
// echo $msg;
// echo $sms_api_url;die();
$client = new \GuzzleHttp\Client();
$response = $client->post($sms_api_url);
$contents = (string) $response->getBody();
$logger = MYLOG::logFunction();
$logger->info("Msg Send Status",array('response_data' => $contents,'mobile_no' => $no,'msg' => $msg,'sms_api_url' => $sms_api_url));
}
}
?>