public function checkChallenge()
    {
        $request  = new CheckChallenge();

        /** @var CheckChallengeResponse $response */
        $response     =  $this->service->execute($request, $this->position);
        $challengeUrl = trim($response->getChallengeUrl());

        if ($response->getShowChallenge() || !empty($challengeUrl)) {
            if (!$this->captchaSolver instanceof Solver) {
                $this->getLogger()->alert("Account has been flagged for CAPTCHA. No CAPTCHA-solver defined, returning challenge.");
                return $challengeUrl;
            }

            $this->getLogger()->alert("Account has been flagged for CAPTCHA. Attempting to solve CAPTCHA with defined resolver.");

            /* Attempt to solve CAPTCHA */
            $token = $this->captchaSolver->solve($challengeUrl);
            $this->getLogger()->info("Received CAPTCHA solution. Verifying...");

            /* Wait 1 second before firing verification request. */
            sleep(1);
            $verify = $this->verifyChallenge($token);

            if ($verify->hasSuccess()) {
                $this->getLogger()->info("Successfully solved CAPTCHA.");
                return true;
            }

            throw new FailedCaptchaException("Failed to resolve CAPTCHA.");
        }

        return false;
    }
public function checkChallenge()
    {
        $request  = new CheckChallenge();

        /** @var CheckChallengeResponse $response */
        $response     =  $this->service->execute($request, $this->position);
        $challengeUrl = trim($response->getChallengeUrl());

        if ($response->getShowChallenge() || !empty($challengeUrl)) {
            if (!$this->captchaSolver instanceof Solver) {
                $this->getLogger()->alert("Account has been flagged for CAPTCHA. No CAPTCHA-solver defined, returning challenge.");
                return $challengeUrl;
            }

            $this->getLogger()->alert("Account has been flagged for CAPTCHA. Attempting to solve CAPTCHA with defined resolver.");

            /* Attempt to solve CAPTCHA */
            $token = $this->captchaSolver->solve($challengeUrl);
            $this->getLogger()->info("Received CAPTCHA solution. Verifying...");

            /* Wait 1 second before firing verification request. */
            sleep(1);
            $verify = $this->verifyChallenge($token);

            if ($verify->hasSuccess()) {
                $this->getLogger()->info("Successfully solved CAPTCHA.");
                return true;
            }

            throw new FailedCaptchaException("Failed to resolve CAPTCHA.");
        }

        return false;
    }
public function checkChallenge ( ) { $ request = new CheckChallenge ( ) ; /** @var CheckChallengeResponse $response */ $ response = $ this -> service -> execute ( $ request , $ this -> position ) ; $ challengeUrl = trim ( $ response -> getChallengeUrl ( ) ) ; if ( $ response -> getShowChallenge ( ) || ! empty ( $ challengeUrl ) ) { if ( ! $ this -> captchaSolver instanceof Solver ) { $ this -> getLogger ( ) -> alert ( "Account has been flagged for CAPTCHA. No CAPTCHA-solver defined, returning challenge." ) ; return $ challengeUrl ; } $ this -> getLogger ( ) -> alert ( "Account has been flagged for CAPTCHA. Attempting to solve CAPTCHA with defined resolver." ) ; /* Attempt to solve CAPTCHA */ $ token = $ this -> captchaSolver -> solve ( $ challengeUrl ) ; $ this -> getLogger ( ) -> info ( "Received CAPTCHA solution. Verifying..." ) ; /* Wait 1 second before firing verification request. */ sleep ( 1 ) ; $ verify = $ this -> verifyChallenge ( $ token ) ; if ( $ verify -> hasSuccess ( ) ) { $ this -> getLogger ( ) -> info ( "Successfully solved CAPTCHA." ) ; return true ; } throw new FailedCaptchaException ( "Failed to resolve CAPTCHA." ) ; } return false ; }
Check if there is a CAPTCHA challenge.

Returns the challenge if there is
Returns false if there is not.

Will attempt to solve the Captcha if a Solver is defined.

@return string|bool

@throws Exception
@throws FailedCaptchaException
Check if there is a CAPTCHA challenge .