36 lines
1.2 KiB
PHP

<?php
namespace App\Utilities;
class SmsLibrary{
public static function SendMnotitySms($data){
$endPoint = 'https://api.mnotify.com/api/sms/quick';
$apiKey = env('MNOTOFYKEY');
$url = $endPoint . '?key=' . $apiKey;
$data = [
'recipient' => [$data['recipient']],
'sender' => 'LUPMIS',
'message' => $data['message'],
'is_schedule' => false,
'schedule_date' => '',
// uncomment the below line to send OTP sms
// When sms_type: "otp" is included in your payload, a charge of 0.035 per campaign will be deducted from your main wallet.
// 'sms_type': 'otp' please do not include in payload when the purpose of the blast is not for otp
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$result = curl_exec($ch);
// $result = json_decode($result, TRUE);
curl_close($ch);
return $result;
}
}