summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander NeonXP Kiryukhin <frei@neonxp.info>2016-06-18 13:25:01 +0300
committerAlexander NeonXP Kiryukhin <frei@neonxp.info>2016-06-18 13:25:01 +0300
commit46ede2d67f442a4a2f06b1899f1935b6ef4c2149 (patch)
tree98762cb7d67bdb6ac03372ca56e3934c58ae69e7
parentf89131443d571fe6487d24c2ba612c358351aa82 (diff)
Fix code enter
-rw-r--r--src/NeonXP/DozorApi.php14
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)