You are here

private function PurgeHandlerCurl::get_curl_request in Purge 7.2

Function to construct a curl request object.

2 calls to PurgeHandlerCurl::get_curl_request()
PurgeHandlerCurl::execute_multi in includes/purge.class.inc
Function to process multiple purges with curl.
PurgeHandlerCurl::execute_single in includes/purge.class.inc
Function to procerss a single purge with curl.

File

includes/purge.class.inc, line 607
Contains all class and interface definitions for Purge.

Class

PurgeHandlerCurl
Class definition for the Curl HTTP request library.

Code

private function get_curl_request($purge, $handler_options) {
  $headers = array();
  foreach ($purge['headers'] as $header_key => $header_value) {
    $headers[] = $header_key . ": " . $header_value;
  }
  $curl_request = curl_init();
  curl_setopt($curl_request, CURLOPT_CUSTOMREQUEST, $handler_options['method']);
  curl_setopt($curl_request, CURLOPT_URL, $purge['purge_url']);
  curl_setopt($curl_request, CURLOPT_HEADER, 1);
  curl_setopt($curl_request, CURLOPT_HTTPHEADER, $purge['headers']);
  curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 0);
  return $curl_request;
}