// 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']; switch ($cuch_menu) { case "main": // Following is the main menu switch ($receiver->getMessage()) { case "1": $operations->session_menu = "On";