(PECL pecl_http >= 0.10.0)

HttpRequest::addHeadersAdd headers


public bool HttpRequest::addHeaders ( array $headers )

Add request header name/value pairs.

Список параметров


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

Возвращаемые значения

Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.

[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
2008-11-04 06:20:07

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