You are here

function _recaptcha_test_recaptcha_server in reCAPTCHA 8

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

Return value

bool Whether or not the reCAPTCHA server is up.

2 calls to _recaptcha_test_recaptcha_server()
recaptcha_captcha in ./recaptcha.module
Implements hook_captcha().
recaptcha_captcha_validation in ./recaptcha.module
CAPTCHA Callback; Validates the reCAPTCHA code.

File

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

Code

function _recaptcha_test_recaptcha_server() {
  $fs = @fsockopen(RECAPTCHA_VERIFY_SERVER, 80, $errno, $errstr, 10);
  if ($fs) {
    fclose($fs);
    return TRUE;
  }
  else {
    drupal_set_message(t('Unable to connect with the reCAPTCHA server (@server): @errno: @errstr', array(
      '@server' => RECAPTCHA_VERIFY_SERVER,
      '@errno' => $errno,
      '@errstr' => $errstr,
    )), 'error');
    return FALSE;
  }
}