Initial commit

This commit is contained in:
Kwesi Banson Jnr
2026-08-04 14:50:01 +00:00
commit 2cfcfade4e
1605 changed files with 499334 additions and 0 deletions

64
app/Libs/Smsgateway.php Executable file
View File

@@ -0,0 +1,64 @@
<?php
namespace App\Libs;
use Config;
use Log;
use App;
class Smsgateway {
function sendSms($msisdn, $message){
$url ="http://10.199.0.10/ucm_api/index.php";
$data = array (
'reference' => uniqid('_airtime'),
'message_type' => "1",
'message' => $message,
'user_id' => "288",
'app_id' => "600118",
'org_id' => "82",
'src_address' => "349",
'dst_address' => $msisdn,
'service_id' => "",
'operation' => "send",
'timestamp' => preg_replace('/\D/', '', date("YYYYmmddHHiiss")),
'auth_key' => md5(600118 . date("YYYYmmddHHiiss") . "!QAZ2wsx*")
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$ucm_response = curl_exec($curl);
@file_put_contents("/var/www/html/malawi/airtime_sales_portal/public/logs/" . date("Y_m_d_") . "sms_responses.txt", $ucm_response . PHP_EOL, FILE_APPEND);
return $ucm_response;
}
function sendSmsNew($msisdn, $message){
$url = "http://10.199.0.10:8989/api/messaging/sendsms";
$token = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI4MiIsIm9pZCI6ODIsInVpZCI6IjRkNTUzZTZhLTBmYzAtNDJjNy05MWMyLTk5ZmUzNDliNWFmYSIsImFwaWQiOjkxLCJpYXQiOjE2NDg0NjQxOTQsImV4cCI6MTk4ODQ2NDE5NH0.Nndr6MshNvpiYoqv3aLI_sw9kSZP1dUUBa-aWQ1y0iHlkLe0DhLZymUl430IBVOOGI--Rl_ur1JEAJ-8BRhS2w";
$data = array (
'from' => "349",
'to' => $msisdn,
'message' => $message,
'refId' => uniqid('_airtime')
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"Authorization: Bearer $token",
"Content-type: application/json"
));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$ucm_response = curl_exec($curl);
@file_put_contents("/var/www/html/malawi/airtime_sales_portal/public/logs/" . date("Y_m_d_") . "sms_responses.txt", $ucm_response . PHP_EOL, FILE_APPEND);
return $ucm_response;
}
}
?>