SunshinePHP 2016


(PECL pecl_http >= 0.10.0)

HttpRequest::addHeadersAjoute des en-têtes


public bool HttpRequest::addHeaders ( array $headers )

Ajoute des paires nom/valeur aux en-têtes demandés.

Liste de paramètres


un tableau associatif contenant les paires nom/valeur additionnelles d'en-têtes

Valeurs de retour

Cette fonction retourne TRUE en cas de succès ou FALSE si une erreur survient.

add a note add a note

User Contributed Notes 1 note

6 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
To Top