\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(); print(""); foreach($api->validate(isset($_GET["name"]) ? $_GET["name"] : $_POST["name"]) as $station) { print("" . $station["id"] . "" . $station["value"] . "\n"); } print(""); } else if ($type == "conn" || $type == "connection" || $type == "connections") { if ((isset($_GET["from"]) && isset($_GET["to"])) || (isset($_POST["from"]) && isset($_POST["to"]))) { prepare(); $from = (isset($_GET["from"]) && isset($_GET["to"]) ? $api->validate($_GET["from"])[0]["id"] : $api->validate($_POST["from"])[0]["id"]); $to = (isset($_GET["from"]) && isset($_GET["to"]) ? $api->validate($_GET["to"])[0]["id"] : $api->validate($_POST["to"])[0]["id"]); $count = (isset($_GET["count"]) ? $_GET["count"] : (isset($_POST["count"]) ? $_POST["count"] : 3)); $date = (isset($_GET["date"]) ? $_GET["date"] : (isset($_POST["date"]) ? $_POST["date"] : null)); $time = (isset($_GET["time"]) ? $_GET["time"] : (isset($_POST["time"]) ? $_POST["time"] : null)); $mode = (isset($_GET["mode"]) ? $_GET["mode"] : (isset($_POST["mode"]) ? $_POST["mode"] : null)); print("\n"); /* foreach ($api->get($from, $to, $count, $date, $time, $mode) as $conn) { print("Connection"); var_dump($conn); print("Details"); var_dump($api->getDetails($conn["id"])); print("Coords"); var_dump($api->getCoords()); } */ foreach ($api->get($from, $to, $count, $date, $time, $mode) as $conn) { print(" \n"); print(" " . trim($conn["startStation"]) . "" . $api->validate($conn["startStation"])[0]["id"] . "\n"); print(" " . trim($conn["endStation"]) . "" . $api->validate($conn["endStation"])[0]["id"] . "\n"); print("
\n"); print(" " . $conn["startDate"] . "\n"); print(" " . $conn["endDate"] . "\n"); print(" " . $conn["duration"] . "\n"); print(" " . $conn["changes"] . "\n"); print(" " . htmlspecialchars($conn["prognose"], ENT_XML1, 'UTF-8') . "\n"); print("
\n"); print(" \n"); $order = 0; foreach ($api->getDetails($conn["id"]) as $service) { print(" \n"); print(" " . $service["data"]["productName"] . "\n"); print(" \n"); print(" " . trim($service["start"]["station"]) . "" . $api->validate($service["start"]["station"])[0]["id"] . "\n"); print(" " . $service["start"]["date"] . "\n"); print(" " . $service["start"]["plattform"] . "\n"); print(" " . htmlspecialchars($service["start"]["prognose"], ENT_XML1, 'UTF-8') . "\n"); print(" \n"); print(" \n"); print(" " . trim($service["end"]["station"]) . "" . $api->validate($service["end"]["station"])[0]["id"] . "\n"); print(" " . $service["end"]["date"] . "\n"); print(" " . $service["end"]["plattform"] . "\n"); print(" " . htmlspecialchars($service["end"]["prognose"], ENT_XML1, 'UTF-8') . "\n"); print(" \n"); print(" \n"); $order++; } print(" \n"); print("
\n"); } print("
\n"); } else { error("Required 'from' and/or 'to' arguments missing."); } } else { error("Unknown request type provided."); }