} return true; } } session_start(); if (!array_key_exists('user', $_SESSION)) { exit("Authentication required."); } session_commit(); $proxy = new ApiProxy(); $query = $proxy->getPost(); if (strlen($query) == 0) { return "query is not set."; } $type = array_key_exists('type', $_GET) ? $_GET['type'] : 'default'; switch ($type) { case 'series': $response = $proxy->seriesJsonQuery($query); break; case 'properties': $response = $proxy->propertiesJsonQuery($query); break; default: $response = ""; break; } header('Content-Type: application/json; charset=UTF-8;'); ob_start('ob_gzhandler'); echo json_encode($response); ob_end_flush(); exit;