PHP Doku:: Add headers - function.httprequest-addheaders.html

Verlauf / Chronik / History: (2) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige DiensteHTTPThe HttpRequestHttpRequest::addHeaders

Ein Service von Reinhard Neidl - Webprogrammierung.

The HttpRequest

<<HttpRequest::addCookies

HttpRequest::addPostFields>>

HttpRequest::addHeaders

(PECL pecl_http >= 0.10.0)

HttpRequest::addHeadersAdd headers

Beschreibung

public bool HttpRequest::addHeaders ( array $headers )

Add request header name/value pairs.

Parameter-Liste

headers

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

Rückgabewerte

Gibt bei Erfolg TRUE zurück. Im Fehlerfall wird FALSE zurückgegeben.


Ein BenutzerBeitrag:
- Beiträge aktualisieren...
pal
4.11.2008 13:20
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



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)