From 7bbc83d1878d31528fd7eee28dadb6d84f488043 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 17 Jun 2024 12:22:08 -0400 Subject: [PATCH] sms --- app/Controllers/BaseController.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index a6f778a..5fe2ee3 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -167,9 +167,19 @@ abstract class BaseController extends Controller // // curl_close($curl); // return $response; + log_message('error', "SMS TO API---=>". $to_number); $curl = curl_init(); + $data = array( + "to"=> $to_number, + "from"=> "DigiFI", + "sms"=> "Hi there, testing 123456", + "type"=> "plain", + "channel"=> "generic", + "api_key"=> $API_KEY, + ); + $post_data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => 'https://termii.com/api/sms/send', CURLOPT_RETURNTRANSFER => true, @@ -179,23 +189,14 @@ abstract class BaseController extends Controller CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'{ - - "to": $to_number, - "from": "DigiFI", - "sms": "Hi there, testing 123456", - "type": "plain", - "channel": "generic", - "api_key": $API_KEY, - - }', + CURLOPT_POSTFIELDS => $post_data, CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), )); $response = curl_exec($curl); - + log_message('error', "SMS TO API Response---=>". $response); curl_close($curl); return $response; }