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; $ussdOperation = $receiver->getUssdOperation(); // get the ussd operation $responseMsg = array("main" => "Welcome To Arduino Demo\n\n1. On\n2. Off \n\n99. Exit"); if ($ussdOperation == "mo-init") {
ini_set('error_log', 'ussd-app-error.log'); require 'libs/MoUssdReceiver.php'; require 'libs/MtUssdSender.php'; require 'class/operationsClass.php'; require 'log.php'; require 'db.php'; require 'connect.php'; $ussdserverurl = "https://api.dialog.lk/ussd/send"; $receiver = new UssdReceiver(); $sender = new UssdSender($ussdserverurl, 'APP_000001', 'password'); $operations = new Operations(); $receiverSessionId = $receiver->getSessionId(); $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; $ussdOperation = $receiver->getUssdOperation(); // get the ussd operation $responseMsg = array("main" => "Keth-Net\n1. Sinhala\n2. English\n\n99. Exit", "Sinhala" => "Keth-Net\n1. Ganudenu Karuweku sandaha visthara laba ganima\n2. Wagahimiyeku sandaha visthara laba ganima\n\n99. Exit", "English" => "Keth-Net\n1. Information about farmers\n2. Information about buyers\n\n99. Exit", "Pradeshaya" => "Keth-Net\n1. Oba Pradeshaye\n2. Wenath Pradeshayaka\n\n99. Exit", "Province" => "Keth-Net\n1. Of your Province\n2. Of another Province\n\n99. Exit", "PalathList" => "Keth-Net\n1.Uthuru mada\n2.Madyama\n3.Uthura\n4.Basnahira\n5.Dakuna\n6.Nagenahira\n7.Sabaragabuwa\n8.Wayamba\n9.Uva\n\n99. Exit", "ProvinceList" => "Keth-Net\n1.North Central\n2.Central\n3.North\n4.Western\n5.Sourthern\n6.Earstern\n7.Sabaragabuwa\n8.North Western\n9.Uva\n\n99. Exit"); if ($ussdOperation == "mo-init") {