private function KalturaClientBase::doCurl in Kaltura 6.2
* Curl HTTP POST Request * *
Parameters
string $url: * @param array $params * @return array of result and error
1 call to KalturaClientBase::doCurl()
- KalturaClientBase::doHttpRequest in kaltura_client/
KalturaClientBase.php - * Send http request by using curl (if available) or php stream_context * *
File
- kaltura_client/
KalturaClientBase.php, line 187
Class
Code
private function doCurl($url, $params = array(), $files = array()) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
if (count($files) > 0) {
foreach ($files as &$file) {
$file = "@" . $file;
}
// let curl know its a file
curl_setopt($ch, CURLOPT_POSTFIELDS, array_merge($params, $files));
}
else {
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params, null, "&"));
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, '');
if (count($files) > 0) {
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
}
else {
curl_setopt($ch, CURLOPT_TIMEOUT, $this->config->curlTimeout);
}
$result = curl_exec($ch);
$curlError = curl_error($ch);
curl_close($ch);
return array(
$result,
$curlError,
);
}