protected function LingotekOAuthRequester::prepareCurlOptions in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/LingotekOAuthRequester.php \LingotekOAuthRequester::prepareCurlOptions()
- 7.4 lib/oauth-php/library/LingotekOAuthRequester.php \LingotekOAuthRequester::prepareCurlOptions()
- 7.5 lib/oauth-php/library/LingotekOAuthRequester.php \LingotekOAuthRequester::prepareCurlOptions()
* Mix the given headers into the headers that were given to curl * *
Parameters
array curl_options: * @param array extra_headers * @return array new curl options
1 call to LingotekOAuthRequester::prepareCurlOptions()
- LingotekOAuthRequester::doRequest in lib/
oauth-php/ library/ LingotekOAuthRequester.php - * Perform the request, returns the response code, headers and body. * *
File
- lib/
oauth-php/ library/ LingotekOAuthRequester.php, line 496
Class
Code
protected function prepareCurlOptions($curl_options, $extra_headers) {
$hs = array();
if (!empty($curl_options[CURLOPT_HTTPHEADER]) && is_array($curl_options[CURLOPT_HTTPHEADER])) {
foreach ($curl_options[CURLOPT_HTTPHEADER] as $h) {
list($opt, $val) = explode(':', $h, 2);
$opt = str_replace(' ', '-', ucwords(str_replace('-', ' ', $opt)));
$hs[$opt] = $val;
}
}
$curl_options[CURLOPT_HTTPHEADER] = array();
$hs = array_merge($hs, $extra_headers);
foreach ($hs as $h => $v) {
$curl_options[CURLOPT_HTTPHEADER][] = "{$h}: {$v}";
}
return $curl_options;
}