$to_number
This commit is contained in:
@@ -142,30 +142,61 @@ abstract class BaseController extends Controller
|
||||
public function sendSMS($to_number):string{
|
||||
$API_KEY ="TLYsgMTZBeasJHHimcWXG1QPHmjH7FPwnbKwiqTEwGCu6TrK0v13hCn8N6SYZp";
|
||||
$BASE_URL = "https://api.ng.termii.com";
|
||||
$curl = curl_init();
|
||||
$data = array("api_key" => $API_KEY, "to" => $to_number, "from" => "talert",
|
||||
"sms" => "Hi there, testing Termii ", "type" => "plain", "channel" => "generic" );
|
||||
// $curl = curl_init();
|
||||
// $data = array("api_key" => $API_KEY, "to" => $to_number, "from" => "talert",
|
||||
// "sms" => "Hi there, testing Termii ", "type" => "plain", "channel" => "generic" );
|
||||
//
|
||||
// $post_data = json_encode($data);
|
||||
//
|
||||
// curl_setopt_array($curl, array(
|
||||
// CURLOPT_URL => $BASE_URL."/api/sms/send",
|
||||
// CURLOPT_RETURNTRANSFER => true,
|
||||
// CURLOPT_ENCODING => "",
|
||||
// CURLOPT_MAXREDIRS => 10,
|
||||
// CURLOPT_TIMEOUT => 0,
|
||||
// CURLOPT_FOLLOWLOCATION => true,
|
||||
// CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
// CURLOPT_CUSTOMREQUEST => "POST",
|
||||
// CURLOPT_POSTFIELDS => $post_data,
|
||||
// CURLOPT_HTTPHEADER => array(
|
||||
// "Content-Type: application/json"
|
||||
// ),
|
||||
// ));
|
||||
//
|
||||
// $response = curl_exec($curl);
|
||||
//
|
||||
// curl_close($curl);
|
||||
// return $response;
|
||||
|
||||
$post_data = json_encode($data);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => $BASE_URL."/api/sms/send",
|
||||
CURLOPT_URL => 'https://termii.com/api/sms/send',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => $post_data,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_POSTFIELDS =>'{
|
||||
|
||||
"to": $to_number,
|
||||
"from": "DigiFI",
|
||||
"sms": "Hi there, testing 123456",
|
||||
"type": "plain",
|
||||
"channel": "generic",
|
||||
"api_key": $API_KEY,
|
||||
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
"Content-Type: application/json"
|
||||
'Content-Type: application/json'
|
||||
),
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
return $response;
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user