You are here

protected function Fastly::queryMultiple in Fastly 7.2

Performs multiple HTTP queries to Fastly API server without returning a result.

Parameters

array $uris: The URIs to use for the request, appended to the host.

array $data: (optional) Data to send with the request.

string $method: (optional) The method to use for the request, defaults to GET.

array $headers: (optional) An array of headers to send with the request.

1 call to Fastly::queryMultiple()
Fastly::purgeKeys in ./fastly.api.inc
Purge cache by multiple keys.

File

./fastly.api.inc, line 264
Contains Faslt class that handles API calls to the Fastly service.

Class

Fastly
Fastly API for Drupal.

Code

protected function queryMultiple(array $uris, $data = array(), $method = 'GET', $headers = array()) {
  foreach ($uris as $uri) {
    $urls[] = $this->host . $uri;
  }
  $options['headers'] = $headers;
  $options['method'] = $method;
  $options['data'] = http_build_query($data);
  if ($this->api_key) {
    $options['headers']['Fastly-Key'] = $this->api_key;
  }
  if (module_exists('httprl')) {

    // We just want to execute the queue but not wait.
    $options['blocking'] = FALSE;
    httprl_request($urls, $options);
    httprl_send_request();
  }
  else {
    foreach ($urls as $url) {
      drupal_http_request($url, $options);
    }
  }
}