protected function DrupalApacheSolrService::_makeHttpRequest in Apache Solr Search 8
Same name and namespace in other branches
- 6.3 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::_makeHttpRequest()
- 7 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::_makeHttpRequest()
Central method for making the actual http request to the Solr Server
This is just a wrapper around drupal_http_request().
4 calls to DrupalApacheSolrService::_makeHttpRequest()
- DrupalApacheSolrService::makeServletRequest in ./
Drupal_Apache_Solr_Service.php - Make a request to a servlet (a path) that's not a standard path.
- DrupalApacheSolrService::ping in ./
Drupal_Apache_Solr_Service.php - Call the /admin/ping servlet, to test the connection to the server.
- DrupalApacheSolrService::_sendRawGet in ./
Drupal_Apache_Solr_Service.php - Central method for making a GET operation against this Solr Server
- DrupalApacheSolrService::_sendRawPost in ./
Drupal_Apache_Solr_Service.php - Central method for making a POST operation against this Solr Server
File
- ./
Drupal_Apache_Solr_Service.php, line 502
Class
- DrupalApacheSolrService
- Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.
Code
protected function _makeHttpRequest($url, array $options = array()) {
if (!isset($options['method']) || $options['method'] == 'GET' || $options['method'] == 'HEAD') {
// Make sure we are not sending a request body.
$options['data'] = NULL;
}
$result = drupal_http_request($url, $options);
if (!isset($result->code) || $result->code < 0) {
$result->code = 0;
$result->status_message = 'Request failed';
$result->protocol = 'HTTP/1.0';
}
// Additional information may be in the error property.
if (isset($result->error)) {
$result->status_message .= ': ' . check_plain($result->error);
}
if (!isset($result->data)) {
$result->data = '';
$result->response = NULL;
}
else {
$response = json_decode($result->data);
if (is_object($response)) {
foreach ($response as $key => $value) {
$result->{$key} = $value;
}
}
}
return $result;
}