Retrieves only the headers for a Drupal path or an absolute path.
$path: Drupal path or URL to load into internal browser
$options: Options to be forwarded to the url generator.
$headers: An array containing additional HTTP request headers, each formatted as "name: value".
The retrieved headers, also available as $this->drupalGetContent()
protected function drupalHead($path, array $options = array(), array $headers = array()) {
$options['absolute'] = TRUE;
$url = $this->container
->get('url_generator')
->generateFromPath($path, $options);
$out = $this
->curlExec(array(
CURLOPT_NOBODY => TRUE,
CURLOPT_URL => $url,
CURLOPT_HTTPHEADER => $headers,
));
$this
->refreshVariables();
// Ensure that any changes to variables in the other thread are picked up.
if ($this->dumpHeaders) {
$this
->verbose('GET request to: ' . $path . '<hr />Ending URL: ' . $this
->getUrl() . '<hr />Headers: <pre>' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '</pre>');
}
return $out;
}