You are here

function linkchecker_check_http_request in Link checker 5.2

Backport of D6 system_check_http_request() function.

http://api.drupal.org/api/function/system_check_http_request.

File

./linkchecker.install, line 163
Installation file for Link Checker module.

Code

function linkchecker_check_http_request() {

  // Try to get the content of the front page via drupal_http_request().
  $result = drupal_http_request(url('', array(
    'absolute' => TRUE,
  )));

  // We only care that we get a http response - this means that Drupal
  // can make a http request.
  $works = isset($result->code) && $result->code >= 100 && $result->code < 600;
  variable_set('drupal_http_request_fails', !$works);
  return $works;
}