public function Http::getResponse in Migrate Plus 8
Same name and namespace in other branches
- 8.5 src/Plugin/migrate_plus/data_fetcher/Http.php \Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http::getResponse()
- 8.2 src/Plugin/migrate_plus/data_fetcher/Http.php \Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http::getResponse()
- 8.3 src/Plugin/migrate_plus/data_fetcher/Http.php \Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http::getResponse()
- 8.4 src/Plugin/migrate_plus/data_fetcher/Http.php \Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http::getResponse()
Return Http Response object for a given url.
Parameters
$url: URL to retrieve from.
Return value
\Psr\Http\Message\ResponseInterface
Overrides DataFetcherPluginInterface::getResponse
1 call to Http::getResponse()
- Http::getResponseContent in src/
Plugin/ migrate_plus/ data_fetcher/ Http.php - Return content.
File
- src/
Plugin/ migrate_plus/ data_fetcher/ Http.php, line 68 - Contains Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http.
Class
- Http
- Retrieve data over an HTTP connection for migration.
Namespace
Drupal\migrate_plus\Plugin\migrate_plus\data_fetcherCode
public function getResponse($url) {
try {
$response = $this->httpClient
->get($url, array(
'headers' => $this
->getRequestHeaders(),
));
if (empty($response)) {
throw new MigrateException('No response at ' . $url . '.');
}
} catch (RequestException $e) {
throw new MigrateException('Error message: ' . $e
->getMessage() . ' at ' . $url . '.');
}
return $response;
}