为Curl类添加自定义头信息功能

This commit is contained in:
Li Jianxuan 2013-11-15 03:44:52 +00:00
parent 2ca99a2de3
commit beb002b648
1 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,8 @@ class Curl
'verifyssl' => true, 'verifyssl' => true,
), $options); ), $options);
} }
public $H;
/** /**
* Send a request to the server, receive a response * Send a request to the server, receive a response
@ -69,6 +71,11 @@ class Curl
} else { } else {
$headers[] = 'Content-Length: 0'; $headers[] = 'Content-Length: 0';
} }
if(!empty($this->H) && is_array($this->H) && count($this->H) > 0)
{
$headers = array_merge($headers,$this->H);
}
$this->debug('send '.$httpMethod.' request: '.$url); $this->debug('send '.$httpMethod.' request: '.$url);