public function verify($response, $remoteIp = null)
    {
        $this->errors = [];
        try {
            $response = (new Client())->get($this->verificationUrl($response, $remoteIp))->send();
        } catch (GuzzleException $e) {
            $this->errors[] = 'transfer-error';

            return false;
        }
        
        if ($response->getStatusCode() !== 200) {
            $this->errors[] = 'api-error';

            return false;
        }

        try {
            $responseBody = $response->json();
        } catch (GuzzleException $e) {
            $this->errors[] = 'response-error';

            return false;
        }
        
        if (isset($responseBody['error-codes'])) {
            $this->errors = $responseBody['error-codes'];
        }
        return $responseBody['success'];
    }
public function verify($response, $remoteIp = null)
    {
        $this->errors = [];
        try {
            $response = (new Client())->get($this->verificationUrl($response, $remoteIp))->send();
        } catch (GuzzleException $e) {
            $this->errors[] = 'transfer-error';

            return false;
        }
        
        if ($response->getStatusCode() !== 200) {
            $this->errors[] = 'api-error';

            return false;
        }

        try {
            $responseBody = $response->json();
        } catch (GuzzleException $e) {
            $this->errors[] = 'response-error';

            return false;
        }
        
        if (isset($responseBody['error-codes'])) {
            $this->errors = $responseBody['error-codes'];
        }
        return $responseBody['success'];
    }
public function verify ( $ response , $ remoteIp = null ) { $ this -> errors = [ ] ; try { $ response = ( new Client ( ) ) -> get ( $ this -> verificationUrl ( $ response , $ remoteIp ) ) -> send ( ) ; } catch ( GuzzleException $ e ) { $ this -> errors [ ] = 'transfer-error' ; return false ; } if ( $ response -> getStatusCode ( ) !== 200 ) { $ this -> errors [ ] = 'api-error' ; return false ; } try { $ responseBody = $ response -> json ( ) ; } catch ( GuzzleException $ e ) { $ this -> errors [ ] = 'response-error' ; return false ; } if ( isset ( $ responseBody [ 'error-codes' ] ) ) { $ this -> errors = $ responseBody [ 'error-codes' ] ; } return $ responseBody [ 'success' ] ; }
Queries the Google API to determine if the CAPTCHA is valid.

@param  string $response The user response token.
@param  string $remoteIp The user's IP address.
@return boolean
Queries the Google API to determine if the CAPTCHA is valid .