Exemple #1
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 Response Response from the service.
  */
 public function verify($response, $remoteIp = null)
 {
     // Discard empty solution submissions
     if (empty($response)) {
         $recaptchaResponse = new Response(false, array('missing-input-response'));
         return $recaptchaResponse;
     }
     $params = new RequestParameters($this->secret, $response, $remoteIp, self::VERSION);
     $rawResponse = $this->requestMethod->submit($params);
     return Response::fromJson($rawResponse);
 }