Example #1
0
        $sender->ussd($sessionId, $responseMsg["main"], $address);
    } catch (Exception $e) {
        $sender->ussd($sessionId, 'Please try again', $address);
    }
} else {
    $flag = 0;
    $sessiondetails = $operations->getSession($sessionId);
    $cuch_menu = $sessiondetails['menu'];
    $operations->session_id = $sessiondetails['sessionsid'];
    switch ($cuch_menu) {
        case "main":
            // Following is the main menu
            switch ($receiver->getMessage()) {
                case "1":
                    $operations->session_menu = "On";
                    $response = $smssender->sms('on', $address);
                    $operations->saveSesssion();
                    $sender->ussd($sessionId, 'Enter Your ID', $address);
                    break;
                case "2":
                    $operations->session_menu = "Off";
                    $operations->saveSesssion();
                    $response = $smssender->sms('off', $address);
                    $sender->ussd($sessionId, 'Enter Your ID', $address);
                    break;
                default:
                    $operations->session_menu = "main";
                    $operations->saveSesssion();
                    $sender->ussd($sessionId, $responseMsg["main"], $address);
                    break;
            }
Example #2
0
<?php

require "../vendor/autoload.php";
// Application Details
$applicationId = "APP_0001";
$password = "******";
$smsIn = new SMSReceiver();
$address = $smsIn->getAddress();
$message = $smsIn->getMessage();
$url = "http://localhost:7000/sms/send";
$smsOut = new SMSSender($url, $applicationId, $password);
$smsOut->sms("Got the message", $address);
$smsOut->broadcast("This message is broadcasted - " . $message);
Example #3
0
                $sms_sender = new SMSSender($SMS_SERVER_URL, $APP_ID, $PASSWORD);
                $sms_sender->sms($rep_msg, $address);
            } else {
                if ($respons_no == "2" || $respons_no == "02") {
                    $operations->session_menu = "main";
                    $operations->saveSesssion();
                    $rep_msg = "Your alert is Canceled. Emergency No : 011-1234567";
                    $sms_sender = new SMSSender($SMS_SERVER_URL, $APP_ID, $PASSWORD);
                    $sms_sender->sms($rep_msg, $address);
                    $operations->closeConn();
                } else {
                    $operations->session_menu = "main";
                    $operations->saveSesssion();
                    $rep_msg = "Your responce is Wrong. Emergency No : 011-1234567";
                    $sms_sender = new SMSSender($SMS_SERVER_URL, $APP_ID, $PASSWORD);
                    $sms_sender->sms($rep_msg, $address);
                    $operations->closeConn();
                }
            }
        case "99":
            $sender->ussd($sessionId, 'Thank you using our service !', $address, 'mt-fin');
            break;
        default:
            $operations->session_menu = "main";
            $operations->saveSesssion();
            $sender->ussd($sessionId, 'Incorrect option ' . $cuch_menu, $address);
            break;
    }
}
function getModifiedTimeStamp($timeStamp)
{
Example #4
0
// Licence : MIT License
// http://opensource.org/licenses/MIT
// ==========================================
ini_set('error_log', 'sms-app-error.log');
require_once 'lib/Log.php';
require_once 'lib/SMSReceiver.php';
require_once 'lib/SMSSender.php';
define('SERVER_URL', 'http://localhost:7000/sms/send');
define('APP_ID', 'APPID');
define('APP_PASSWORD', 'password');
$logger = new Logger();
try {
    // Creating a receiver and intialze it with the incomming data
    $receiver = new SMSReceiver(file_get_contents('php://input'));
    //Creating a sender
    $sender = new SMSSender(SERVER_URL, APP_ID, APP_PASSWORD);
    $message = $receiver->getMessage();
    // Get the message sent to the app
    $address = $receiver->getAddress();
    // Get the phone no from which the message was sent
    $logger->WriteLog($receiver->getAddress());
    if ($message == 'broadcast') {
        // Send a broadcast message to all the subcribed users
        $response = $sender->broadcast("This is a broadcast message to all the subcribers of the application");
    } else {
        // Send a SMS to a particular user
        $response = $sender->sms('This message is sent only to one user', $address);
    }
} catch (SMSServiceException $e) {
    $logger->WriteLog($e->getErrorCode() . ' ' . $e->getErrorMessage());
}
Example #5
0
 $message = $receiver->getMessage();
 // Get the message sent to the app
 $address = $receiver->getAddress();
 // Get the phone no from which the message was sent
 $logger->WriteLog($receiver->getAddress());
 $status01 = 'No_Request';
 $status02 = 'Processing';
 $status03 = 'Processed';
 $status = 'Processed';
 //$status='Processing';
 //$status='No_Request';
 list($keyword, $statusChk) = explode(" ", $message);
 if ($statusChk == 'STATUS') {
     if ($status == $status01) {
         // Send a broadcast message to all the subcribed users
         $response = $sender->sms('You have not requested any service', $address);
     } else {
         if ($status == $status02) {
             // Send a SMS to a particular user
             $response = $sender->sms('Your Request is Processing', $address);
         } else {
             if ($status == $status03) {
                 // Send a SMS to a particular user
                 $response = $sender->sms('Your Service Processed', $address);
             }
         }
     }
 }
 //list($keyword,$statusChk)=explode(" ",$message);
 /*if ($statusChk=='No_Request') {
 
Example #6
0
 list($keyword, $service, $statusChk) = explode(" ", $message);
 if ($keyword == 'htag') {
     if ($service == 'RL') {
         $result1 = mysql_query("SELECT test_id FROM se_test WHERE vehicle_number = '{$statusChk}' AND status='pass'");
         if (mysql_num_rows($result1) > 0) {
             $result2 = mysql_query("SELECT record_id FROM insurance_record WHERE vehicle_number = '{$statusChk}'");
             if (mysql_num_rows($result2) > 0) {
                 while ($row = mysql_fetch_array($result2)) {
                     $insuranceId = $row["record_id"];
                 }
                 $result3 = mysql_query("SELECT * FROM license_record WHERE Insurance_Recordrecord_id = {$insuranceId}");
                 if (mysql_num_rows($result3) > 0) {
                     while ($row = mysql_fetch_array($result3)) {
                         $status = $row["status"];
                         if ($status == 0) {
                             $response = $sender->sms('Your Request is processing', $address);
                         } else {
                             if ($status == 1) {
                                 $response = $sender->sms('Your Request is finished processing', $address);
                             }
                         }
                     }
                 } else {
                     // here if new request
                     $response = $sender->sms('Your Service Request started processing', $address);
                 }
             } else {
                 $response = $sender->sms('Your have no insurance policy', $address);
             }
         } else {
             $response = $sender->sms('We have not pass the smoke emission test or we have no record of you.', $address);