Initial commit

This commit is contained in:
Kwesi Banson Jnr
2026-03-19 11:03:33 +00:00
commit c68c007945
8388 changed files with 520335 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Utilities;
class ApiCalls
{
/**
* Create a new class instance.
*/
public static function CurlGet($url){
$get_url = env('APIBASEURL') . $url;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $get_url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(),
));
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
public static function CurlPost($data, $url){
$post_url = env('APIBASEURL') . $url;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $post_url,
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 => $data,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
public static function generatePassword($length = 10) {
return bin2hex(random_bytes($length / 2));
}
}