示例#1
0
$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") {
    try {
        $sessionArrary = array("sessionsid" => $sessionId, "tel" => $address, "menu" => "main", "pg" => "", "others" => "");
        $operations->setSessions($sessionArrary);
        $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'];