Обновлены настройки Client, дозапись в базу

This commit is contained in:
2024-08-22 17:03:25 +03:00
parent fd5fe013b0
commit 30733f294c
5 changed files with 93 additions and 68 deletions

View File

@ -27,15 +27,18 @@ class ContingentParser
{
libxml_use_internal_errors(true);
$dom = new \DOMDocument(
encoding: "UTF-8"
// encoding: "UTF-8"
);
$html = mb_convert_encoding(
$html,
'UTF-8',
mb_detect_encoding($html, 'UTF-8, windows-1251')
);
$html = str_replace('windows-1251','utf-8', $html);
$dom->loadHTML($html);
if (mb_detect_encoding($html, 'UTF-8, windows-1251') != "UTF-8") {
$html = mb_convert_encoding(
$html,
'UTF-8',
mb_detect_encoding($html, 'UTF-8, windows-1251')
);
$html = str_replace('windows-1251','utf-8', $html);
} else {
$dom->loadHTML(mb_convert_encoding($html,'HTML-ENTITIES','UTF-8'));
}
$this->xpath = new \DOMXPath($dom);
$this->template = $template;
}