public function isValid()
	{
	  	// Skip without submission
		if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') {

			return FALSE;

		} else {

			$captchaChallenge = isset($_POST['recaptcha_challenge_field'])
				? $this->_sanitizeField($_POST['recaptcha_challenge_field'])
				: NULL;

			$captchaResponse  = isset($_POST['recaptcha_response_field'])
				? $this->_sanitizeField($_POST['recaptcha_response_field'])
				: NULL;
		 	// Skip empty submission
			if ( strlen($captchaChallenge) == 0 || strlen($captchaResponse) == 0 ) {
				$this->setError('incorrect-captcha-sol');
				return FALSE;
			}

			$data = array(
				'privatekey' => $this->_privateKey,
				'remoteip'   => $this->_remoteIp(),
				'challenge'  => $captchaChallenge,
				'response'   => $captchaResponse
				);

			$result = $this->_postHttpChallenge($data);

			if ( $result['isvalid'] === "true") {
				return TRUE;

			} else {
				$this->setError($result['error']);
			}
			return FALSE;
		}
	}
public function isValid()
	{
	  	// Skip without submission
		if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') {

			return FALSE;

		} else {

			$captchaChallenge = isset($_POST['recaptcha_challenge_field'])
				? $this->_sanitizeField($_POST['recaptcha_challenge_field'])
				: NULL;

			$captchaResponse  = isset($_POST['recaptcha_response_field'])
				? $this->_sanitizeField($_POST['recaptcha_response_field'])
				: NULL;
		 	// Skip empty submission
			if ( strlen($captchaChallenge) == 0 || strlen($captchaResponse) == 0 ) {
				$this->setError('incorrect-captcha-sol');
				return FALSE;
			}

			$data = array(
				'privatekey' => $this->_privateKey,
				'remoteip'   => $this->_remoteIp(),
				'challenge'  => $captchaChallenge,
				'response'   => $captchaResponse
				);

			$result = $this->_postHttpChallenge($data);

			if ( $result['isvalid'] === "true") {
				return TRUE;

			} else {
				$this->setError($result['error']);
			}
			return FALSE;
		}
	}
public function isValid ( ) { // Skip without submission if ( strtoupper ( $ _SERVER [ 'REQUEST_METHOD' ] ) !== 'POST' ) { return FALSE ; } else { $ captchaChallenge = isset ( $ _POST [ 'recaptcha_challenge_field' ] ) ? $ this -> _sanitizeField ( $ _POST [ 'recaptcha_challenge_field' ] ) : NULL ; $ captchaResponse = isset ( $ _POST [ 'recaptcha_response_field' ] ) ? $ this -> _sanitizeField ( $ _POST [ 'recaptcha_response_field' ] ) : NULL ; // Skip empty submission if ( strlen ( $ captchaChallenge ) == 0 || strlen ( $ captchaResponse ) == 0 ) { $ this -> setError ( 'incorrect-captcha-sol' ) ; return FALSE ; } $ data = array ( 'privatekey' => $ this -> _privateKey , 'remoteip' => $ this -> _remoteIp ( ) , 'challenge' => $ captchaChallenge , 'response' => $ captchaResponse ) ; $ result = $ this -> _postHttpChallenge ( $ data ) ; if ( $ result [ 'isvalid' ] === "true" ) { return TRUE ; } else { $ this -> setError ( $ result [ 'error' ] ) ; } return FALSE ; } }
Verifying reCAPTCHA User's Answer
resolves response challenge return TRUE if the answer matches

@return bool
Verifying reCAPTCHA User s Answer resolves response challenge return TRUE if the answer matches