File: /var/www/html/sarvodayahospital/app/Sms.php
<?php
namespace app;
use GuzzleHttp\Client;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\Facades\Http;
/**
* Class Sms to send SMS on Mobile Numbers.
*
* @author Subhendu Giri
*/
class Sms
{
public function __construct()
{
}
private $SMS_USER = 't1sarvodayahospitalapi';
private $SMS_PASS = 'Rabrakha2023';
private $SMS_SENDER_ID = 'SRVDYA';
private $SMS_ENTITY_ID = '1701158056165732117';
private $SMS_TEMPLATE_ID = '1507166866175416818';
private $RESPONSE_TYPE = 'json';
public function sendOTP($OTP, $mobileNumber)
{
$isError = 0;
$errorMessage = true;
// $message = urlencode($OTP.' is your One Time Password to login into your Sarvodaya Healthcare account. Please do not share your OTP with anyone. Thank You');
$message = urlencode($OTP.' is your One Time Password to login into your Sarvodaya Healthcare account. Please do not share your OTP with anyone. Thank You');
try {
// $smsURL = 'http://nimbusit.co.in/api/swsendSingle.asp?username=t1sarvodayahospitalapi&password=Rabrakha2023&sender=SRVDYA&sendto='.$mobileNumber.'&entityID=1701158056165732117&templateID=1507166866175416818&message='.$message;
$smsURL = 'https://nimbusit.biz/api/SmsApi/SendSingleApi?UserID=sarvodayahbiz&Password=mfmy5236MF&SenderID=SRVDYA&EntityID=1701158056165732117&Phno='.$mobileNumber.'&TemplateID=1507166866175416818&Msg='.$message;
$response = Http::get($smsURL);
info('SMS API');
info($response);
return $response->ok();
} catch (ConnectionException $exception) {
return 'Connection not established';
}
}
public function sendWhatsAppConfirmationSMS($mobileNumber) {
$url = "https://sarvodayahospital19.com/pdm/API_NOIDA/nursing_conclave";
$client = new Client();
$response = $client->post($url, [
'form_params' => [
'mobile' => $mobileNumber
],
]);
return json_decode($response->getBody(), true);
}
public function sendConfirmation($mobileNumber, $patient_name, $doctor_name, $date_time, $hospital_name, $appointment_id, $help_line)
{
$isError = 0;
$errorMessage = true;
$message = urlencode('Dear '.$patient_name.', your appointment with '.$doctor_name.' has been confirmed for '.$date_time.' at '.$hospital_name.'; Appointment id: '.$appointment_id.'; For any assistance, please call '.$help_line.' SRVDYA ');
try {
$smsURL = 'http://nimbusit.co.in/api/swsendSingle.asp?username=t1sarvodayahospitalapi&password=Rabrakha21&sender=SRVDYA&sendto='.$mobileNumber.'&entityID=1701158056165732117&templateID=1507167447614026495&message='.$message;
//return $smsURL;
$response = Http::get($smsURL);
return $response->ok();
} catch (ConnectionException $exception) {
return 'Connection not established';
}
}
}