1 system.module system_check_http_request()

Checks whether the server is capable of issuing HTTP requests.

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

Note that this check was never 100% reliable. On some web servers, it would return FALSE even if external requests were allowed. Use of this function has been deprecated and it will be removed in Backdrop 2.0.

Return value

TRUE if this installation can issue HTTP requests.:

Deprecated

since 1.3.1

File

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

Code

function system_check_http_request() {
  watchdog_deprecated_function('system', __FUNCTION__);
  // Try to get the content of the home page via backdrop_http_request().
  $result = backdrop_http_request(url('', array('absolute' => TRUE)), array('max_redirects' => 0, 'timeout' => 10));
  // We only care that we get a http response - this means that Backdrop
  // can make a http request.
  $works = isset($result->code) && ($result->code >= 100) && ($result->code < 600);
  return $works;
}