sms
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user