code: public function checkAnswer($extraParams = array()) {
          $remoteIp = $_SERVER["REMOTE_ADDR"];
          $challenge = $_POST["recaptcha_challenge_field"];
          $response = $_POST["recaptcha_response_field"];
          
          if ( ! $this->getPrivateKey()) {
              throw new \Exception("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
          }
  
          if ( ! $remoteIp) {
              throw new \Exception("For security reasons, you must pass the remote ip to reCAPTCHA");
          }
  
          if ( ! $challenge) { // discard spam submissions
              $this->valid = false;
              $this->error = 'incorrect-captcha-sol';
          } else { // or check user input
              $response = $this->httpPost(self::RECAPTCHA_VERIFY_SERVER, '/recaptcha/api/verify',
                      array(
                          'privatekey' => $this->getPrivateKey(),
                          'remoteip' => $remoteIp,
                          'challenge' => $challenge,
                          'response' => $response,
                      ) + $extraParams
                  );
  
              $answers = explode("\n", $response[1]);
              if (trim($answers[0]) == 'true') {
                  $this->valid = true;
              } else {
                  $this->valid = false;
                  $this->error = $answers[1];
              }
          }
          
          return $this;
      }
docs: Calls an HTTP POST function to verify if the user's guess was correct
  
  @param array $extraParams An array of extra variables to post to the server
  @return $this
  @throws \Exception