cu = curl_init(); curl_setopt($this->cu, CURLOPT_FOLLOWLOCATION, true); curl_setopt($this->cu, CURLOPT_MAXREDIRS, 1); curl_setopt($this->cu, CURLOPT_RETURNTRANSFER, true); $this->tags_to_strip = array( '%%', '%
%', '%%', ); } public function getPage($page) { curl_setopt($this->cu, CURLOPT_URL, self::PREFIX.rawurlencode($page).self::SUFFIX); return curl_exec($this->cu); } public function get_roomlist() { $listpage = explode('', $this->getPage(''))[1]; $rooms = array(); preg_match_all('%]+>/([^<]+)%i', $listpage, $rooms); return $rooms[1]; } public function get_roomdata($room) { return $this->getPage($room); } public function has_contents($roomdata) { return trim(preg_replace('/<[^>]+>/', '', $roomdata)); } public function trim_extra_tags($roomdata) { return trim(preg_replace($this->tags_to_strip, '', $roomdata)); } }