*/
 header('Content-Type: text/x-json');
 if (isset($_POST['requestingUser'])) {
     $requestingUser = $_POST['requestingUser'];
     $username = $_POST['username'];
     $start = $_POST['start'];
     $end = $_POST['end'];
     $requestType = $_POST['requestType'];
 } else {
     $action = "";
 }
 try {
     $params = array('requestingUser' => $requestingUser, 'userName' => $username, 'start' => $start, 'end' => $end);
     $client = new SoapClient($wsdl, array('location' => $location));
     if ($requestType == "User") {
         $result = $client->getUserAppointments($params);
     } else {
         if ($requestType == "Mentor") {
             $result = $client->getMentorAppointments($params);
         } else {
             if ($requestType == "Host") {
                 $result = $client->getHostAppointments($params);
             }
         }
     }
     echo json_encode($result->appointments);
 } catch (Exception $e) {
     echo $e->getMessage();
 } catch (SoapFault $soapfault) {
     echo $soapfault->getMessage();
 }