diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/NeonXP/DozorApi.php | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/NeonXP/DozorApi.php b/src/NeonXP/DozorApi.php index 9bfc049..5a6498c 100644 --- a/src/NeonXP/DozorApi.php +++ b/src/NeonXP/DozorApi.php @@ -77,15 +77,11 @@ class DozorApi private function parseCodeEnter($html) { - $result = iconv('cp1251', 'utf8', $html); - $result = mb_strtolower($result, 'utf8'); - if (strpos($result, 'код принят')) { - $result = 'Код принят'; - } else { - $result = 'Код НЕ принят'; - } - - return $result; + $html = iconv('cp1251', 'utf8', $html); + $regex = '/\<\!\-\-errorText\-\-\>\<p\>\<strong\>(.+?)\<\/strong\>\<\/p\>\<\!\-\-errorTextEnd\-\-\>' + $result = []; + preg_match($regex, $html, $result); + return $result[1]; } private function parseTask(Crawler $crawler) |