sms and update admin

changes
This commit is contained in:
2026-06-12 12:57:23 +05:45
parent 3b529327bf
commit 85e87beaf6
8 changed files with 519 additions and 13 deletions
+35
View File
@@ -0,0 +1,35 @@
<?php
if (! function_exists('sendSMS')) {
function sendSMS(string $destination, string $message): bool
{
$key = env('SMS_API') ?: '';
$sender = env('SMS_SENDER') ?: 'SMSBit';
$url = env('SMS_URL') ?: 'https://sms.bibhutisolutions.com/smsapi/index';
$params = http_build_query([
'key' => $key,
'contacts' => $destination,
'senderid' => $sender,
'msg' => $message,
'responsetype' => 'json',
]);
$separator = parse_url($url, PHP_URL_QUERY) ? '&' : '?';
$url_final = $url . $separator . $params;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_final);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($response === false || $httpCode >= 400) {
return false;
}
return true;
}
}