You are here

function _recaptcha_test_recaptcha_server in reCAPTCHA 7

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

Test whether the reCAPTCHA server is up.

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 178
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;
  }
}