$sslopt = array("local_cert" => "{$sslpath}/combinedcert.pem", "verify_peer" => false);
    $conn = new Session("127.0.0.1", 7961, $sslopt, "NONE");
    $doctype = $_GET["doctype"];
    if ($doctype == "") {
        $doctype = "ListEmployee";
    }
    if ($doctype == "ListEmployee") {
        $query = '<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE "employee" SYSTEM "ListEmployee.simpleform"><employee></employee>';
    } else {
        if ($doctype == "ListCustomer") {
            $query = '<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE "customer" SYSTEM "ListCustomer.simpleform"><customer></customer>';
        } else {
            if ($doctype == "ListProject") {
                $query = '<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE "project" SYSTEM "ListProject.simpleform"><project></project>';
            } else {
                throw new Exception("unknown document type '" . $doctype . "'");
            }
        }
    }
    if (($result = $conn->request($query)) === FALSE) {
        throw new Exception($conn->lasterror());
    } else {
        echo "<html><head><title>" . $doctype . "</title></head><body>" . htmlspecialchars($result) . "</body></html>";
    }
    unset($conn);
} catch (\Exception $e) {
    echo "<html><head><title>ERROR</title></head><body>" . $e->getMessage() . "</body></html>";
}
?>

        }
    }
    foreach ($_REQUEST as $key => $value) {
        if ($key == "CMD") {
            $cmd = $value;
        } else {
            if ($key == "DOCTYPE") {
            } else {
                $content[$key] = $value;
            }
        }
    }
    $authopt = array("mech" => "NONE", "username" => "gunibert", "password" => "bork123");
    $doc = array();
    $doc['-doctype'] = $doctype;
    $doc[$root] = $content;
    $body = json_encode($doc);
    $conn = new Session("127.0.0.1", 7962, $sslopt, $authopt);
    if (($result = $conn->request($cmd, $body)) === FALSE) {
        echo "<html><head><title>FAILED</title></head><body>" . $conn->lasterror() . "</body></html>";
    } else {
        echo "<html><head><title>RESULT</title></head><body><p>" . $result . "</p></body></html>";
    }
    unset($conn);
} catch (\Exception $e) {
    echo "<html><head><title>ERROR</title></head><body>" . $e->getMessage() . "</body></html>";
}
?>


            }
        }
    }
    $body .= "</{$root}>\n";
    if ($ssl_enabled == true) {
        $sslpath = "./SSL";
        $sslopt = array("local_cert" => "{$sslpath}/combinedcert.pem", "verify_peer" => false);
    }
    if ($password != NULL && $username != NULL) {
        $authopt = array("mech" => "WOLFRAME-CRAM", "username" => $username, "password" => $password);
    }
    $port = 7661;
    if ($ssl_enabled) {
        $port = 7961;
    }
    $conn = new Session("127.0.0.1", $port, $sslopt, $authopt);
    if (($result = $conn->request($cmd, $body)) === FALSE) {
        echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
        echo "<error><class>ANSWER</class><message>" . $conn->lasterror() . "</message></error>";
    } else {
        echo $result;
    }
    unset($conn);
} catch (\Exception $e) {
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    echo "<error><class>EXCEPTION</class><message>" . $e->getMessage() . "</message></error>";
}
?>