public function getCaptchaResult($captchaId)
    {
        $response = $this
            ->getHttpClient()
            ->request('GET', "/res.php?key={$this->apiKey}&action=get&id={$captchaId}&json=1");

        $responseData = json_decode($response->getBody()->__toString(), true);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new InvalidArgumentException(
                'json_decode error: ' . json_last_error_msg()
            );
        }

        if ($responseData['status'] === self::STATUS_CODE_CAPCHA_NOT_READY) {
            return false;
        }

        if ($responseData['status'] === self::STATUS_CODE_OK) {
            $this->getLogger()->info("Got OK response: `{$responseData['request']}`.");
            return $responseData['request'];
        }

        throw new ErrorResponseException(
            $this->getErrorMessage(
                $responseData['request']
            ) ?: $responseData['request'],
            $responseData['status']
        );
    }
public function getCaptchaResult($captchaId)
    {
        $response = $this
            ->getHttpClient()
            ->request('GET', "/res.php?key={$this->apiKey}&action=get&id={$captchaId}&json=1");

        $responseData = json_decode($response->getBody()->__toString(), true);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new InvalidArgumentException(
                'json_decode error: ' . json_last_error_msg()
            );
        }

        if ($responseData['status'] === self::STATUS_CODE_CAPCHA_NOT_READY) {
            return false;
        }

        if ($responseData['status'] === self::STATUS_CODE_OK) {
            $this->getLogger()->info("Got OK response: `{$responseData['request']}`.");
            return $responseData['request'];
        }

        throw new ErrorResponseException(
            $this->getErrorMessage(
                $responseData['request']
            ) ?: $responseData['request'],
            $responseData['status']
        );
    }
public function getCaptchaResult ( $ captchaId ) { $ response = $ this -> getHttpClient ( ) -> request ( 'GET' , "/res.php?key={$this->apiKey}&action=get&id={$captchaId}&json=1" ) ; $ responseData = json_decode ( $ response -> getBody ( ) -> __toString ( ) , true ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new InvalidArgumentException ( 'json_decode error: ' . json_last_error_msg ( ) ) ; } if ( $ responseData [ 'status' ] === self :: STATUS_CODE_CAPCHA_NOT_READY ) { return false ; } if ( $ responseData [ 'status' ] === self :: STATUS_CODE_OK ) { $ this -> getLogger ( ) -> info ( "Got OK response: `{$responseData['request']}`." ) ; return $ responseData [ 'request' ] ; } throw new ErrorResponseException ( $ this -> getErrorMessage ( $ responseData [ 'request' ] ) ? : $ responseData [ 'request' ] , $ responseData [ 'status' ] ) ; }
Override generic method for using json response.

@param string $captchaId # Captcha task ID
@return false|string             # Solved captcha text or false if captcha is not ready
@throws ErrorResponseException
@throws InvalidArgumentException
@throws \GuzzleHttp\Exception\GuzzleException
Override generic method for using json response .