}
    }
    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>";
}
?>


Пример #2
0
    $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>";
}
?>