protected function Xml::doGetRequest in Views XML Backend 8
Performs a GET request.
Parameters
string $url: The URL to GET.
array $options: Options to pass to Guzzle.
Return value
\Psr\Http\Message\ResponseInterface An HTTP response.
1 call to Xml::doGetRequest()
- Xml::fetchRemoteFile in src/
Plugin/ views/ query/ Xml.php - Returns the contents of a remote file.
File
- src/
Plugin/ views/ query/ Xml.php, line 688 - Contains \Drupal\views_xml_backend\Plugin\views\query\Xml.
Class
- Xml
- Views query plugin for an XML query.
Namespace
Drupal\views_xml_backend\Plugin\views\queryCode
protected function doGetRequest($url, $options = []) {
try {
return $this->httpClient
->get($url, $options);
} catch (\RuntimeException $e) {
// @todo We can add more granular error messages based on Guzzle exception
// types. We could also display this error with dsm() if we're in preview.
$args = [
'@url' => $url,
'%message' => $e
->getMessage(),
];
$this->logger
->error('An error occured while downloading @url: %message.', $args);
if ($this->livePreview) {
$this->messenger
->setMessage($this
->t('An error occured while downloading @url: %message.', $args), 'error');
}
}
// Fake a response.
return new Response(-100, [], '');
}