GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.138.125.86
Web Server : Apache
System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : jnclnmuac ( 1026)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/jnclnmuac/public_html/web/../alumni/../css/../cas/application/libraries/util/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../alumni/../css/../cas/application/libraries/util/SMSSender.php
<?php

/* * *************************************************
 * File Name: SMSSender.php                          *            
 * File Description: Utility Class For Sending SMS.  *
 * Author: Softpro India Pvt. Ltd.                   *
 * Date Created: 29/04/2018                          *
 * Date Last Modified: 04/02/2020                    *
  /************************************************** */

class SMSSender {

    const BASE_URL = '';
    const USER_NAME = '';
    const PASSWORD = '';
    const SENDER_ID = '';
    const RESPONSE = 'Y';
    const FINAL_URL_PRE = self::BASE_URL . 'username=' . self::USER_NAME . '&pass=' . self::PASSWORD . '&senderid=' . self::SENDER_ID . '&message=';
    const FINAL_URL_POST = '&response=' . self::RESPONSE;

    public function sendSMS($mobile, $message) {
        $ch = curl_init();
        $url = self::FINAL_URL_PRE . urlencode($message) . "&dest_mobileno=" . $mobile . self::FINAL_URL_POST;
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $deliveryResponse = curl_exec($ch);
        $response = explode("-", $deliveryResponse)[0];
        curl_close($ch);
        $error_code = ($response != '0') ? "000" : "-1";
        $deliveryStatus = ($error_code == '000' || $error_code == 000) ? "T" : "F";
        self::logThisSMSTransaction($deliveryStatus, $mobile, $message, self::SENDER_ID);
    }

    public static function logThisSMSTransaction($deliveryStatus, $mobile, $message, $senderId) {
        $CI = & get_instance();
        $form_data = array(
            'sms_number' => $mobile,
            'sms_content' => $message,
            'sms_sender_id' => $senderId,
            'sms_delivery_status' => $deliveryStatus,
            'sms_date' => date("Y-m-d H:i:s")
        );
        $CI->load->database();
        $CI->db->insert('sent_sms_log', $form_data);
    }

}

KBHT - 2023