/** * Retrieves the requested page from the WebArchiveBundle and echo it page, * base64 encoded */ function cache() { $offset = $this->clean($_REQUEST['offset'], "int"); $partition = $this->clean($_REQUEST['partition'], "int"); $crawl_time = $this->clean($_REQUEST['crawl_time'], "string"); $prefix = ""; if (isset($_REQUEST['instance_num'])) { $prefix = $this->clean($_REQUEST['instance_num'], "int") . "-"; } if (file_exists(CRAWL_DIR . '/cache/' . $prefix . self::archive_base_name . $crawl_time)) { $web_archive = new WebArchiveBundle(CRAWL_DIR . '/cache/' . $prefix . self::archive_base_name . $crawl_time); $page = $web_archive->getPage($offset, $partition); echo base64_encode(serialize($page)); } else { echo base64_encode(serialize(false)); } }