Zepher Ashe 2 лет назад
Родитель
Сommit
9f1c926400
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      classes/DomDocumentParser.php

+ 5 - 2
classes/DomDocumentParser.php

@@ -5,13 +5,16 @@ class DomDocumentParser
 
 
 	public function __construct($url) 
 	public function __construct($url) 
 	{
 	{
+		$html = '<?xml encoding="UTF-8">';
+
 		$options = array(
 		$options = array(
 			'http'=>array('method'=>"GET", 'header'=>"User-Agent: doogleBot/0.1\n")
 			'http'=>array('method'=>"GET", 'header'=>"User-Agent: doogleBot/0.1\n")
 			);
 			);
 		$context = stream_context_create($options);
 		$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
 		//@ Error supression is unnecessary, PHP>7.0 supports HTML5
 	}
 	}