You are here

function system_check_http_request in Drupal 6

Same name and namespace in other branches
  1. 7 modules/system/system.module \system_check_http_request()

Checks whether the server is capable of issuing HTTP requests.

The function sets the drupal_http_request_fail system variable to TRUE if drupal_http_request() does not work and then the system status report page will contain an error.

Return value

TRUE if this installation can issue HTTP requests.

1 call to system_check_http_request()
system_requirements in modules/system/system.install
Implementation of hook_requirements().

File

modules/system/system.module, line 1957
Configuration system that lets administrators modify the workings of the site.

Code

function system_check_http_request() {

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

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