Exemple #1
0
 /**
  * Calls the reCAPTCHA siteverify API to verify whether the user passes
  * CAPTCHA test. (reCAPTCHA version php_1.1.1)
  *
  * @param string $response The value of 'g-recaptcha-response' in the submitted form.
  * @param string $remoteIp The end user's IP address.
  * @return ReCaptchaResponse Response from the service.
  */
 public function verify($response, $remoteIp = null)
 {
     if (empty($response)) {
         // Discard empty solution submissions
         return new ReCaptchaResponse(false, array('missing-input'));
     }
     $params = array('version' => self::$version, 'secret' => $this->_secret, 'remoteip' => $remoteIp, 'response' => $response);
     $rawResponse = $this->_submit($params);
     return ReCaptchaResponse::fromJson($rawResponse);
 }
Exemple #2
0
 /**
  * Calls the reCAPTCHA siteverify API to verify whether the user passes
  * CAPTCHA test.
  *
  * @param string $response The value of 'g-recaptcha-response' in the submitted form.
  * @param string $remoteIp The end user's IP address.
  * @return ReCaptchaResponse Response from the service.
  */
 public function verify($response, $remoteIp = null)
 {
     // Discard empty solution submissions
     if (empty($response)) {
         $recaptchaResponse = new ReCaptchaResponse(false, array('missing-input-response'));
         return $recaptchaResponse;
     }
     $params = new ReCaptchaRequestParameters($this->secret, $response, $remoteIp, self::VERSION);
     $rawResponse = $this->requestMethod->submit($params);
     return ReCaptchaResponse::fromJson($rawResponse);
 }