Esempio n. 1
0
$responseMsg;
//your logic goes here......
$split = explode(' ', $content);
$split_number = explode(':', $address);
//split address
$tag = "{$split['2']} {$split['3']}";
// set tag name
$responseMsg = $split[1];
$time_to_stop = $split[4];
$user_iD = $split_number[1];
$contentarray = $split[0];
$store_data = $split[1];
//echo $responseMsg;
// $responseMsg = $user_iD;
$update_time = time() + $time_to_stop * 60 * 60;
$con1 = mysqli_connect("localhost", "billz", "asdasd", "notification");
mysqli_query($con1, "UPDATE priority_taglist SET autho='{$responseMsg}', timetostop= '{$update_time}' WHERE user_id='{$user_iD}' AND tag_name ='{$tag}' ");
$sender = new SmsSender("https://localhost:7443/sms/send");
//sending a one message
$applicationId = $applicationId;
$encoding = "0";
$version = "1.0";
$password = "******";
$sourceAddress = "77160";
$deliveryStatusRequest = "1";
$charging_amount = ":15.75";
$destinationAddresses = $address;
//array("tel:94771122336");
$binary_header = "";
$res = $sender->sms($responseMsg, $destinationAddresses, $password, $applicationId, $sourceAddress, $deliveryStatusRequest, $charging_amount, $encoding, $version, $binary_header);
Esempio n. 2
0
function sendReply($reply, $mask, $url, $info)
{
    $responder = new SmsSender($url);
    $responder->sms($reply, $mask, $info['password'], $info['appId'], $info['srcAddr'], $info['deliveryStatus'], $info['chrgAmnt'], $info['encoding'], $info['ver'], $info['binaryHeader']);
}
Esempio n. 3
0
$production = false;
if ($production == false) {
    $CASS_SERVER_URL = "http://localhost:7000/caas/direct/debit";
    $SMS_SERVER_URL = "http://localhost:7000/sms/send";
} else {
    $CASS_SERVER_URL = 'https://api.dialog.lk/caas/direct/debit';
    $SMS_SERVER_URL = "https://api.dialog.lk/sms/send";
}
$logger = new Logger();
try {
    $receiver = new SMSReceiver();
    $message = $receiver->getMessage();
    // Get the message sent to the app
    $address = $receiver->getAddress();
    // Get the phone no from which the message was sent
    list($keyword, $amount) = explode(" ", $message);
    // Setting up CAAS
    $cass = new DirectDebitSender($CASS_SERVER_URL, $APP_ID, $PASSWORD);
    $sender = new SmsSender($SMS_SERVER_URL, $APP_ID, $PASSWORD);
    try {
        if (isset($amount)) {
            $cass->cass($EXTERNAL_TRX_ID, $address, $amount);
            $sender->sms("Thank you for your generosity, You Have made a donation for " . $amount . " Rupees", $address);
        }
    } catch (CassException $ex) {
        $logger->WriteLog($ex);
        $sender->sms("You do not have sufficient credit to make this donation", $address);
    }
} catch (Exception $e) {
    $logger->WriteLog($e);
}
Esempio n. 4
0
    // get the encoding value
    $version = $receiver->getVersion();
    // get the version
    logFile("[ content={$content}, address={$address}, requestId={$requestId}, applicationId={$applicationId}, encoding={$encoding}, version={$version} ]");
    $responseMsg;
    //your logic goes here......
    $responseMsg = "You are not in the disaster area.You are in uva wellassa";
    // Create the sender object server url
    $sender = new SmsSender("https://api.dialog.lk/sms/send");
    //sending a one message
    $applicationId = "APP_018053";
    $encoding = "0";
    $version = "1.0";
    $password = "******";
    $destinationAddresses = array($address);
    $res = $sender->sms($responseMsg, $destinationAddresses, $password, $applicationId, $encoding, $version);
} catch (SmsException $ex) {
    //throws when failed sending or receiving the sms
    error_log("ERROR: {$ex->getStatusCode()} | {$ex->getStatusMessage()}");
}
/*
    BMI logic function
**/
function bmiLogicHere($split)
{
    if (sizeof($split) < 2) {
        $responseMsg = "Invalid message content";
    } else {
        $weight = (double) $split[0];
        $height = (double) $split[1];
        $bmi = getBMIValue($weight, $height / 100);