You are here

function _chr_curl_set_headers in cURL HTTP Request 7

Same name and namespace in other branches
  1. 6 chr.module \_chr_curl_set_headers()

Set default headers in curl object.

Parameters

array $options [reference]: Options array

object $ch [reference]: cURL Object

1 call to _chr_curl_set_headers()
chr_curl_http_request in ./chr.module
Performs an HTTP request.

File

./chr.module, line 391
cURL HTTP Request methods

Code

function _chr_curl_set_headers(&$options, &$ch) {
  if (is_array($options['headers']) and !empty($options['headers'])) {
    $headers = array();
    foreach ($options['headers'] as $key => $value) {
      $headers[] = trim($key) . ": " . trim($value);
    }
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  }
}