function system_check_http_request
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.
File
- modules/system/system.module, line 3395
- 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('max_redirects' => 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; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.module/function/system_check_http_request/7.x