send sms
This commit is contained in:
@@ -139,4 +139,33 @@ abstract class BaseController extends Controller
|
||||
return $password;
|
||||
}
|
||||
|
||||
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" );
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user