コード例 #1
0
 public function testSmsMakePayloadWithAdditionalSettings()
 {
     $sender = new SMSSender("localhost", "APP001", "password");
     $sender->setsourceAddress("77000");
     $res = $sender->makePayload("hello", array("tel:94123123123"));
     $res = json_decode($res, true);
     $this->assertEquals("77000", $res["sourceAddress"]);
     $this->assertEquals($res["applicationId"], "APP001");
     $this->assertEquals($res["password"], "password");
     $this->assertEquals($res["message"], "hello");
     $this->assertEquals($res["destinationAddresses"][0], "tel:94123123123");
 }
コード例 #2
0
 public function __construct($username, $password, $log_file = false)
 {
     parent::__construct($username, $password, $log_file);
 }
コード例 #3
0
ファイル: ussdap.php プロジェクト: shehanb/ussd-arduino-LED
require 'db.php';
require_once 'libs/SMSReceiver.php';
require_once 'libs/SMSSender.php';
define('APP_ID', 'APPID');
define('APP_PASSWORD', 'password');
$production = false;
if ($production == false) {
    $ussdserverurl = 'http://localhost:7000/ussd/send';
    $smsserverurl = 'http://localhost:7000/sms/send';
} else {
    $ussdserverurl = 'https://api.dialog.lk/ussd/send';
    $smsserverurl = 'http://api.dialog.lk/sms/send';
}
$receiver = new UssdReceiver();
$sender = new UssdSender($ussdserverurl, APP_ID, APP_PASSWORD);
$smssender = new SMSSender($smsserverurl, APP_ID, APP_PASSWORD);
$operations = new Operations();
$content = $receiver->getMessage();
// get the message content
$address = $receiver->getAddress();
// get the sender's address
$requestId = $receiver->getRequestID();
// get the request ID
$applicationId = $receiver->getApplicationId();
// get application ID
$encoding = $receiver->getEncoding();
// get the encoding value
$version = $receiver->getVersion();
// get the version
$sessionId = $receiver->getSessionId();
// get the session ID;
コード例 #4
0
EOT;
$sql2 = $argv[1] . " and";
$sql3 = <<<EOT
 resumes.listing_type_sid=7 and
( jobs.TotalYearsExperience  is NULL or jobs.TotalYearsExperience = 0 or resumes.totalYearsExperience between jobs.TotalYearsExperience - 2 and jobs.TotalYearsExperience + 2)
and ( jobs.Location_State is NULL or jobs.Location_State = "" or resumes.Location_State = jobs.Location_State )
and (jobs.Location_District is NULL or jobs.Location_District = "" or resumes.Location_District = jobs.Location_District )
and (jobs.JobCategory is NULL  or jobs.JobCategory = "" or stringSetIntersect(jobs.JobCategory, resumes.JobCategory) = TRUE)
and (jobs.Occupations is NULL  or jobs.Occupations = "" or stringSetIntersect(jobs.Occupations, resumes.Occupations) = TRUE)
 ) as matchingresumes
where u.sid = matchingresumes.user_sid
EOT;
$sql = $sql1 . $sql2 . $sql3;
echo $sql;
$result = $conn->query($sql);
$conn->close();
if ($result->num_rows > 0) {
    $phoneNumbers = array();
    // output data of each row
    while ($row = $result->fetch_assoc()) {
        echo "phonenumber: " . $row["phonenumber"] . " - Name: " . $row["username"] . "\n";
        $phoneNumbers[] = $row["phonenumber"];
    }
    var_dump($phoneNumbers);
    $smsSender = new SMSSender();
    $result = $smsSender->send("You have been selected for the job of Welder ", $phoneNumbers);
    echo $result;
} else {
    echo "\n no matching results found";
}
// connect to the database
コード例 #5
0
ファイル: testsms.php プロジェクト: pradeepck/vagrant
<?php

/**
 * Created by PhpStorm.
 * User: pradeep.ck
 * Date: 5/29/2015
 * Time: 10:19 AM
 */
require "WebRequest.php";
$smsSender = new SMSSender();
$result = $smsSender->send("Testing with classes", array("7588529619", "7775928628"));
echo $result;
class SMSSender
{
    private $profileId = "20070311";
    private $user = "******";
    private $pwd = "Ui4gzn";
    private $senderId = "Anant Innovation";
    public function send($message, $list)
    {
        $webRequest = new WebRequest();
        $params = array("profileId" => $this->profileId, "user" => $this->user, "pwd" => $this->pwd, "senderId" => $this->senderId, "mobileno" => implode(",", $list), "msgtext" => "this is a test message");
        $result = $webRequest->get("http://bulksmsindia.mobi/sendurlcomma.aspx?", $params);
        return $result;
    }
}
コード例 #6
0
ファイル: sms.php プロジェクト: yasirunilan/ideamart-sdk-php
<?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);
コード例 #7
0
ファイル: ussdap.php プロジェクト: MilindaLaknath/TeamRED
                $rep_msg = "Your alert is recived. We will take the necessary action soon. Emergency No : 011-1234567";
                $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)
コード例 #8
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());
}
コード例 #9
0
ファイル: listener.php プロジェクト: buddhiv/uwuproject
 * Date: 12/8/2015
 * Time: 8:52 PM
 */
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());
    $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
コード例 #10
0
ファイル: listener.php プロジェクト: sugeesh/uwaProject2
 * Time: 8:52 PM
 */
ini_set('error_log', 'sms-app-error.log');
require_once 'lib/Log.php';
require_once 'lib/SMSReceiver.php';
require_once 'lib/SMSSender.php';
include '../connect_to_mysql.php';
define('SERVER_URL', 'https://api.dialog.lk/sms/send');
define('APP_ID', 'APP_018044');
define('APP_PASSWORD', '8b412a3281eec7e92311f4cd232d3cab');
$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());
    $status01 = 'No_Request';
    $status02 = 'Processing';
    $status03 = 'Processed';
    //$status='Processed';
    //$status='Processing';
    //$status='No_Request';
    //list($keyword,$statusChk)=explode(" ",$message);
    list($keyword, $service, $statusChk) = explode(" ", $message);
    if ($keyword == 'htag') {
        if ($service == 'RL') {
コード例 #11
0
ファイル: listener.php プロジェクト: shehanb/sms-arduino-LED
<?php

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 {
        if ($message == 'on') {
            // Send a SMS to a particular user
            $response = $sender->sms('on', $address);
        } else {
            if ($message == 'off') {
                // Send a SMS to a particular user
                $response = $sender->sms('off', $address);