为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

@ -17,6 +17,8 @@ class Curl
), $options); ), $options);
} }
public $H;
/** /**
* Send a request to the server, receive a response * Send a request to the server, receive a response
* *
@ -70,6 +72,11 @@ class Curl
$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);
$curlOptions += array( $curlOptions += array(