Retrieves 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 HTML string, also available as $this->drupalGetContent()
protected function drupalGet($path, array $options = array(), array $headers = array()) {
$options['absolute'] = TRUE;
// We re-using a CURL connection here. If that connection still has certain
// options set, it might change the GET into a POST. Make sure we clear out
// previous options.
$url = $this->container
->get('url_generator')
->generateFromPath($path, $options);
$out = $this
->curlExec(array(
CURLOPT_HTTPGET => TRUE,
CURLOPT_URL => $url,
CURLOPT_NOBODY => FALSE,
CURLOPT_HTTPHEADER => $headers,
));
$this
->refreshVariables();
// Ensure that any changes to variables in the other thread are picked up.
// Replace original page output with new output from redirected page(s).
if ($new = $this
->checkForMetaRefresh()) {
$out = $new;
}
$verbose = 'GET request to: ' . $path . '<hr />Ending URL: ' . $this
->getUrl();
if ($this->dumpHeaders) {
$verbose .= '<hr />Headers: <pre>' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '</pre>';
}
$verbose .= '<hr />' . $out;
$this
->verbose($verbose);
return $out;
}