Исправлена обработка разметки с кодировкой windows-1251

This commit is contained in:
2024-08-21 14:51:01 +03:00
parent 29eeb5bf77
commit 48f540b8af
5 changed files with 22 additions and 20 deletions

View File

@ -64,12 +64,12 @@ for ($i = $start; $i < count($sites); $i++) {
$client = new Client([
'allow_directs' => true,
'track_redirects' => true,
'connect_timeout' => 300.0,
'verify' => false,
// 'http_errors' => false,
'headers' => [
'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 YaBrowser/24.6.0.0 Safari/537.36',
'Content-Type' => 'text/html;charset=utf-8',
'timeout' => 300
'Content-Type' => 'text/html;charset=utf-8'
]
]);
@ -109,17 +109,12 @@ for ($i = $start; $i < count($sites); $i++) {
}
unset($contingent);
}
} catch (ClientException $e) {
} catch (ClientException
| RequestException
| ConnectException
| ServerException $e
) {
$message = implode(' ', $sites[$i]) . "\t" . $e->getCode() . "\t" . $e->getMessage();
Logger::log($pathLogErrorHttp, $message);
} catch (RequestException $e) {
$message = implode(' ', $sites[$i]) . "\t" . $e->getCode() . "\t" . $e->getMessage();
Logger::log($pathLogErrorHttp, $message);
} catch (ConnectException $e) {
$message = implode(' ', $sites[$i]) . "\t" . $e->getCode() . "\t" . $e->getMessage();
Logger::log($pathLogErrorHttp, $message);
} catch (ServerException $e) {
$message = implode(' ', $sites[$i]) . "\t" . $e->getCode() . "\t" . $e->getMessage();
Logger::log($pathLogErrorHttp, $message);
}
}
}