if (DiscoUtils::route('get', '^/$', $parameters, $body)) { header('Content-Type: text/plain; charset=utf-8'); echo "Welcome to DiscoJuice API\n" . "Consult documentation for details about using the API.\n" . "http://discojuice.org"; exit; } else { if (DiscoUtils::route('get', '^/feeds$', $parameters, $body)) { $list = $store->getFeedList(); $response = Feed::toJSONlist($list); // $response = $list; } else { if (DiscoUtils::route('get', '^/geo$', $parameters, $body)) { $geoservice = new GeoService(); $data = array(); $clientIP = $_SERVER['REMOTE_ADDR']; $data['country'] = $geoservice->countryFromIP($clientIP); $data['geo'] = $geoservice->geoFromIP($clientIP); $response = $data; } else { if (DiscoUtils::route('get', '^/pipe/([a-z0-9\\-_]+)$', $parameters, $body)) { $response = $store->getPipe($parameters[1]); unset($response['_id']); } else { if (DiscoUtils::route('get', '^/pipe/([a-z0-9\\-_]+)/disco$', $parameters, $body)) { $c = $store->getPipe($parameters[1]); if ($c === null) { echo "not found pipe " . $parameters[1]; } $pipe = Pipe::fromDB($c); $query = $pipe->getQuery(); $response = $store->getIdPs($query); // $response = $query;