PHP 5.6.0beta1 released

HttpRequest::addHeaders

(PECL pecl_http >= 0.10.0)

HttpRequest::addHeadersAñadir cabeceras

Descripción

public bool HttpRequest::addHeaders ( array $headers )

Añade cabeceras a la petición, en la forma nombre/valor.

Parámetros

headers

array asociativo que contiene las cabeceras adicionales en forma nombre/valor

Valores devueltos

Devuelve TRUE en caso de éxito o FALSE en caso de error.

add a note add a note

User Contributed Notes 1 note

up
3
pal
5 years ago
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
To Top