diff --git a/index.php b/index.php new file mode 100644 index 0000000..5952100 --- /dev/null +++ b/index.php @@ -0,0 +1,57 @@ +\n\n"); + } +} + +if (isset($_GET["debug"])) { + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + error_reporting(E_ALL); +} + +$output = (isset($_GET["output"]) ? strtolower($_GET["output"]) : + (isset($_POST["output"]) ? strtolower($_POST["output"]) : + $output = "xml")); + +if ($output != "xml") { + error("Unknown output type provided."); +} + +if (!isset($_GET["type"]) && !isset($_POST["type"])) { + error("No request type provided."); +} + +$type = strtolower((isset($_GET["type"]) ? $_GET["type"] : $_POST["type"])); + +if ($type == "validate") { + if (!isset($_GET["name"]) && !isset($_POST["name"])) { + error("No station name provided for verification."); + } + + prepare(); + + foreach($api->validate(isset($_GET["name"]) ? $_GET["name"] : $_POST["name"]) as $station) { + print("" . $station["value"] . "\n"); + } + + print(""); + +} else { + error("Unknown request type provided."); +}