protected function checkResult($taskId)
    {
        $this->getLogger()->debug("Requesting Task Status for task {TaskId}", ['TaskId' => $taskId]);

        $postData = [
            'clientKey' => $this->apiKey,
            'taskId'    => $taskId
        ];

        try {
            $response = $this->getClient()->post(static::HOST . '/getTaskResult', [
                'json' => $postData,
                'headers' => [
                    'Content-Type' => 'application/json'
                ]
            ]);
        } catch (GuzzleException\RequestException $e) {
            $this->getLogger()->error("Guzzle Exception {Error}", ['Error' => $e]);
            throw new RemoteSolverException("Error fetching AntiCaptcha Task Status", 0, $e);
        }

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

        if ($decoded === false) {
            $this->getLogger()->error("AntiCaptcha API error");
            return false;
        }

        if ($decoded['errorId'] !== 0) {
            $this->getLogger()->error(
                "Received AntiCaptcha ErrorId: {ErrorId}: {ErrorDescription}",
                [
                    'ErrorId'          => $decoded['errorId'],
                    'ErrorDescription' => $decoded['errorDescription']
                ]
            );
            throw new RemoteSolverException(sprintf("AntiCaptcha error: %s: %s", $decoded['errorId'], $decoded['errorDescription']));
        }

        if ($decoded['status'] == 'processing') {
            $this->getLogger()->debug("Task {TaskId} is still processing...", ['TaskId' => $taskId]);
            return true;
        }

        if ($decoded['status'] == 'ready') {
            $this->getLogger()->debug("Task {TaskId} completed.", ['TaskId' => $taskId]);
            return $decoded['solution']['gRecaptchaResponse'];
        }

        throw new RemoteSolverException(sprintf("Unknown status %s", $decoded['status']));
    }
protected function checkResult($taskId)
    {
        $this->getLogger()->debug("Requesting Task Status for task {TaskId}", ['TaskId' => $taskId]);

        $postData = [
            'clientKey' => $this->apiKey,
            'taskId'    => $taskId
        ];

        try {
            $response = $this->getClient()->post(static::HOST . '/getTaskResult', [
                'json' => $postData,
                'headers' => [
                    'Content-Type' => 'application/json'
                ]
            ]);
        } catch (GuzzleException\RequestException $e) {
            $this->getLogger()->error("Guzzle Exception {Error}", ['Error' => $e]);
            throw new RemoteSolverException("Error fetching AntiCaptcha Task Status", 0, $e);
        }

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

        if ($decoded === false) {
            $this->getLogger()->error("AntiCaptcha API error");
            return false;
        }

        if ($decoded['errorId'] !== 0) {
            $this->getLogger()->error(
                "Received AntiCaptcha ErrorId: {ErrorId}: {ErrorDescription}",
                [
                    'ErrorId'          => $decoded['errorId'],
                    'ErrorDescription' => $decoded['errorDescription']
                ]
            );
            throw new RemoteSolverException(sprintf("AntiCaptcha error: %s: %s", $decoded['errorId'], $decoded['errorDescription']));
        }

        if ($decoded['status'] == 'processing') {
            $this->getLogger()->debug("Task {TaskId} is still processing...", ['TaskId' => $taskId]);
            return true;
        }

        if ($decoded['status'] == 'ready') {
            $this->getLogger()->debug("Task {TaskId} completed.", ['TaskId' => $taskId]);
            return $decoded['solution']['gRecaptchaResponse'];
        }

        throw new RemoteSolverException(sprintf("Unknown status %s", $decoded['status']));
    }
protected function checkResult ( $ taskId ) { $ this -> getLogger ( ) -> debug ( "Requesting Task Status for task {TaskId}" , [ 'TaskId' => $ taskId ] ) ; $ postData = [ 'clientKey' => $ this -> apiKey , 'taskId' => $ taskId ] ; try { $ response = $ this -> getClient ( ) -> post ( static :: HOST . '/getTaskResult' , [ 'json' => $ postData , 'headers' => [ 'Content-Type' => 'application/json' ] ] ) ; } catch ( GuzzleException \ RequestException $ e ) { $ this -> getLogger ( ) -> error ( "Guzzle Exception {Error}" , [ 'Error' => $ e ] ) ; throw new RemoteSolverException ( "Error fetching AntiCaptcha Task Status" , 0 , $ e ) ; } $ decoded = json_decode ( $ response -> getBody ( ) , true ) ; if ( $ decoded === false ) { $ this -> getLogger ( ) -> error ( "AntiCaptcha API error" ) ; return false ; } if ( $ decoded [ 'errorId' ] !== 0 ) { $ this -> getLogger ( ) -> error ( "Received AntiCaptcha ErrorId: {ErrorId}: {ErrorDescription}" , [ 'ErrorId' => $ decoded [ 'errorId' ] , 'ErrorDescription' => $ decoded [ 'errorDescription' ] ] ) ; throw new RemoteSolverException ( sprintf ( "AntiCaptcha error: %s: %s" , $ decoded [ 'errorId' ] , $ decoded [ 'errorDescription' ] ) ) ; } if ( $ decoded [ 'status' ] == 'processing' ) { $ this -> getLogger ( ) -> debug ( "Task {TaskId} is still processing..." , [ 'TaskId' => $ taskId ] ) ; return true ; } if ( $ decoded [ 'status' ] == 'ready' ) { $ this -> getLogger ( ) -> debug ( "Task {TaskId} completed." , [ 'TaskId' => $ taskId ] ) ; return $ decoded [ 'solution' ] [ 'gRecaptchaResponse' ] ; } throw new RemoteSolverException ( sprintf ( "Unknown status %s" , $ decoded [ 'status' ] ) ) ; }
Check if there is a result

@param mixed $taskId

@return bool|string

@todo Clean this up

@throws RemoteSolverException
Check if there is a result