This commit is contained in:
CHIEFSOFT\ameye
2024-06-17 12:03:51 -04:00
parent 3b0b1101e3
commit 7fc8f62b74
3 changed files with 52 additions and 6 deletions
+29
View File
@@ -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;
}
}