echo "Cannot find walkroute with that ID"; } } else { header("HTTP/1.1 400 Bad Request"); echo "Walkroute ID should be numeric!"; } } else { header("HTTP/1.1 400 Bad Request"); echo "Please supply a format (json, gpx) and route ID, and use GET"; exit; } break; case "getByBbox": if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($cget["bbox"]) && preg_match("/^(-?[\\d\\.]+,){3}-?[\\d\\.]+\$/", $cget["bbox"])) { $b = explode(",", $cget["bbox"]); $routes = Walkroute::getRoutesByBbox($conn, $b[0], $b[1], $b[2], $b[3]); Walkroute::outputRoutes($routes, $format); } else { header("HTTP/1.1 400 Bad Request"); echo "Please supply a valid bounding box and a format, and use GET"; } break; case "getByRadius": if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($cget["radius"]) && isset($cget['lon']) && isset($cget['lat']) && preg_match("/^[\\d\\.]+\$/", $cget["radius"]) && preg_match("/^-?[\\d\\.]+\$/", $cget["lat"]) && preg_match("/^-?[\\d\\.]+\$/", $cget["lon"])) { $routes = Walkroute::getRoutesByRadius($conn, $cget['lon'], $cget['lat'], $cget["radius"]); Walkroute::outputRoutes($routes, $format); } else { header("HTTP/1.1 400 Bad Request"); echo "Please supply a lon, lat, radius, and use GET"; } break;