public function DeployServiceRest::httpRequest in Deploy - Content Staging 7.3
Same name and namespace in other branches
- 7.2 includes/DeployServiceRest.inc \DeployServiceRest::httpRequest()
Makes a HTTP request.
Parameters
string $url: The URL to request.
string $method: The request method to use, like 'POST', 'GET' or 'PUT'.
string $data: The payload to send with the request.
1 call to DeployServiceRest::httpRequest()
- DeployServiceRestJSON::deploy in plugins/
DeployServiceRestJSON.inc - Deploy all entities in the $iterator. This method should only move entities over to the endpoint and create unpublished revisions (if supported). The 'publish' method is responsible for publishing all successfully deployed entities.
1 method overrides DeployServiceRest::httpRequest()
- DeployRemoteCcServiceRestJSON::httpRequest in modules/
deploy_remote_cc/ plugins/ DeployRemoteCcServiceRestJSON.inc - Make a HTTP request.
File
- includes/
DeployServiceRest.inc, line 59 - Implementation of a REST based client for deploying entities.
Class
- DeployServiceRest
- Base class for REST-based service plugins.
Code
public function httpRequest($url, $method, $data = NULL) {
$options = array(
'method' => $method,
'headers' => $this->config['headers'],
'data' => $data,
'context' => $this->config['context'],
'timeout' => (double) $this->config['timeout'],
);
if ($this->config['debug']) {
watchdog('deploy', 'Service request: %url <pre>@options</pre>', array(
'%url' => $url,
'@options' => print_r($options, TRUE),
), WATCHDOG_DEBUG);
}
$response = drupal_http_request($url, $options);
if ($this->config['debug']) {
watchdog('deploy', 'Service response: <pre>@response</pre>', array(
'@response' => print_r($response, TRUE),
), WATCHDOG_DEBUG);
}
if (isset($response->error) || !in_array($response->code, array(
200,
304,
))) {
throw new DeployServiceException(t('Service error: @code @error', array(
'@code' => $response->code,
'@error' => $response->error,
)));
}
}