| @@ 49-66 (lines=18) @@ | ||
| 46 | list(, $this->captchaId) = explode('|', $result); |
|
| 47 | $waitTime = 0; |
|
| 48 | sleep($this->requestTimeout); |
|
| 49 | while (true) { |
|
| 50 | $result = $this->getResponse('get'); |
|
| 51 | $this->setError($result); |
|
| 52 | if ($result == 'CAPCHA_NOT_READY') { |
|
| 53 | $waitTime += $this->requestTimeout; |
|
| 54 | if ($waitTime > $this->maxTimeout) { |
|
| 55 | break; |
|
| 56 | } |
|
| 57 | sleep($this->requestTimeout); |
|
| 58 | } else { |
|
| 59 | $ex = explode('|', $result); |
|
| 60 | if (trim($ex[0]) == 'OK') { |
|
| 61 | $this->result = trim($ex[1]); |
|
| 62 | ||
| 63 | return true; |
|
| 64 | } |
|
| 65 | } |
|
| 66 | } |
|
| 67 | throw new Exception('Лимит времени превышен'); |
|
| 68 | } catch (Exception $e) { |
|
| 69 | $this->error = $e->getMessage(); |
|
| @@ 142-159 (lines=18) @@ | ||
| 139 | list(, $this->captchaId) = explode('|', $result); |
|
| 140 | $waitTime = 0; |
|
| 141 | sleep($this->requestTimeout); |
|
| 142 | while (true) { |
|
| 143 | $result = $this->getResponse('get'); |
|
| 144 | $this->setError($result); |
|
| 145 | if ($result == 'CAPCHA_NOT_READY') { |
|
| 146 | $waitTime += $this->requestTimeout; |
|
| 147 | if ($waitTime > $this->maxTimeout) { |
|
| 148 | break; |
|
| 149 | } |
|
| 150 | sleep($this->requestTimeout); |
|
| 151 | } else { |
|
| 152 | $ex = explode('|', $result); |
|
| 153 | if (trim($ex[0]) == 'OK') { |
|
| 154 | $this->result = trim($ex[1]); |
|
| 155 | ||
| 156 | return true; |
|
| 157 | } |
|
| 158 | } |
|
| 159 | } |
|
| 160 | throw new Exception('Лимит времени превышен'); |
|
| 161 | } catch (Exception $e) { |
|
| 162 | $this->error = $e->getMessage(); |
|