You are here

protected function SearchApiAcquiaSearchConnectionV3::adjustUrl in Acquia Search for Search API 7.2

Prepares URL parameters before request.

Parameters

string $url: URL.

Return value

string Adjusted URL.

1 call to SearchApiAcquiaSearchConnectionV3::adjustUrl()
SearchApiAcquiaSearchConnectionV3::prepareRequest in includes/v3/SearchApiAcquiaSearchConnectionV3.php
Prepares request before send.

File

includes/v3/SearchApiAcquiaSearchConnectionV3.php, line 92

Class

SearchApiAcquiaSearchConnectionV3
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 adjustUrl($url) {
  $url_components = parse_url($url);
  if (isset($url_components['scheme'])) {
    $url_components['scheme'] = sprintf('%s://', $url_components['scheme']);
  }
  if (isset($url_components['port'])) {
    $url_components['port'] = sprintf(':%s', $url_components['port']);
  }
  if (!isset($url_components['query'])) {
    $url_components['query'] = '';
  }
  $query_pieces = drupal_get_query_array($url_components['query']);
  $query_pieces['request_id'] = uniqid();
  $query_string = drupal_http_build_query($query_pieces);
  $url_components['query'] = sprintf('?%s', $query_string);
  $url = implode('', $url_components);
  return $url;
}