You are here

function _recaptcha_test_recaptcha_server in reCAPTCHA 6

Same name and namespace in other branches
  1. 8 recaptcha.module \_recaptcha_test_recaptcha_server()
  2. 7 recaptcha.module \_recaptcha_test_recaptcha_server()

Return value

bool TRUE if the reCAPTCHA server is up, FALSE otherwise.

1 call to _recaptcha_test_recaptcha_server()
_recaptcha_server_is_up in ./recaptcha.module
Return the cached output of _recaptcha_test_recaptcha_server().

File

./recaptcha.module, line 172
Uses the reCAPTCHA web service to improve the CAPTCHA system.

Code

function _recaptcha_test_recaptcha_server() {
  $response = drupal_http_request('https://' . RECAPTCHA_VERIFY_SERVER);
  if (empty($response->error)) {
    return TRUE;
  }
  else {
    watchdog('reCAPTCHA', 'Unable to connect with the reCAPTCHA server (@server): @errno: @errstr', array(
      '@server' => RECAPTCHA_VERIFY_SERVER,
      '@errno' => $response->code,
      '@errstr' => $response->error,
    ), WATCHDOG_ERROR);
    return FALSE;
  }
}