function _chr_curl_set_defaults in cURL HTTP Request 7
Same name and namespace in other branches
- 6 chr.module \_chr_curl_set_defaults()
Set default cURL settings.
Parameters
array $options [reference]: Options array
object $ch [reference]: cURL Object
1 call to _chr_curl_set_defaults()
- chr_curl_http_request in ./
chr.module - Performs an HTTP request.
File
- ./
chr.module, line 336 - cURL HTTP Request methods
Code
function _chr_curl_set_defaults(&$options, &$ch) {
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, $options['headers']['User-Agent']);
curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
curl_setopt($ch, CURLOPT_TIMEOUT, $options['timeout']);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $options['timeout']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $options['verify_ssl']);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $options['verify_ssl']);
curl_setopt($ch, CURLOPT_MAXREDIRS, $options['max_redirects']);
// Remove the user agent from the headers as it is already set
unset($options['headers']['User-Agent']);
}