private function setParser($parserType, $body, $is_xml) { switch (true) { case preg_match('/advanced/i', $parserType): $this->parserType = 'simple'; $this->parser = $is_xml ? str_get_xml($body) : str_get_html($body); break; case preg_match('/simple/i', $parserType): $this->parserType = 'simple'; $this->parser = str_get_html($body); break; case preg_match('/phpquery/i', $parserType): $this->parserType = 'phpquery'; $this->parser = @phpQuery::newDocumentHTML($body); break; } }
function file_get_xml($url) { return str_get_xml(file_get_contents($url)); }