HttpRequest::addHeaders

(PECL pecl_http >= 0.10.0)

HttpRequest::addHeadersAdd headers

Description

public bool HttpRequest::addHeaders ( array $headers )

Add request header name/value pairs.

Parameters

headers

an associative array as parameter containing additional header name/value pairs

Return Values

Returns TRUE on success or FALSE on failure.

[an error occurred while processing the directive]

Коментарии

Автор:
If like me you were wondering why your POST request is going out with the header 'Expect: 100-continue' set, it is being added by libcurl.

This can only be noticed when using HttpRequest::getRawRequestMessage() and not HttpRequest::getHeaders(), or of course tcpdump or similar.

To remove this header you can do the following;

$r->addHeaders(array('Expect' => ''));

Note this behaviour has also been reported in http://au.php.net/manual/en/function.curl-setopt.php#82418
2008-11-04 06:20:07
http://php5.kiev.ua/manual/ru/httprequest.addheaders.html

    Поддержать сайт на родительском проекте КГБ