|
@@ -5,13 +5,16 @@ class DomDocumentParser
|
|
|
|
|
|
public function __construct($url)
|
|
|
{
|
|
|
+ $html = '<?xml encoding="UTF-8">';
|
|
|
+
|
|
|
$options = array(
|
|
|
'http'=>array('method'=>"GET", 'header'=>"User-Agent: doogleBot/0.1\n")
|
|
|
);
|
|
|
$context = stream_context_create($options);
|
|
|
+ $getConstants = file_get_contents($url, false, $context);
|
|
|
|
|
|
- $this->doc = new DomDocument();
|
|
|
- @$this->doc->loadHTML(file_get_contents($url, false, $context));
|
|
|
+ $this->doc = new DomDocument('1.0', 'utf-8');
|
|
|
+ @$this->doc->loadHTML($html . $getConstants);
|
|
|
//@ Error supression is unnecessary, PHP>7.0 supports HTML5
|
|
|
}
|
|
|
|