/** * HtmlParser constructor * * @param string $source * @param string $type */ public function __construct($source, $type = 'url') { //supress warnings for poorly formated html libxml_use_internal_errors(true); //Load the html based on type $this->htmlcode = HtmlBuilder::build($source, $type); $this->htmlcode = mb_convert_encoding($this->htmlcode, 'HTML-ENTITIES', "UTF-8"); $this->dom = new DOMDocument(); $this->dom->loadHTML($this->htmlcode); }