PHP Doku:: Set headers - function.httprequest-setheaders.html

Verlauf / Chronik / History: (31) anzeigen

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

Ein Service von Reinhard Neidl - Webprogrammierung.

Verdiene Geld mit Deiner Homepage oder deinem Blog: Setzte eine Textlinkwerbung und bestimme den Preis selber.
Einfach kostenlos anmelden und einen Platz auf Deiner Homepage anbieten.
Make money with your homepage or blog: Set a text link advertising and declare the price.
Register free of charge and offer a place on your homepage.
The HttpRequest

<<HttpRequest::setCookies

HttpRequest::setMethod>>

HttpRequest::setHeaders

(PECL pecl_http >= 0.12.0)

HttpRequest::setHeadersSet headers

Beschreibung

public bool HttpRequest::setHeaders ([ array $headers ] )

Set request header name/value pairs.

Parameter-Liste

headers

an associative array as parameter containing header name/value pairs; if empty or omitted, all previously set headers will be unset

Rückgabewerte

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


Verdiene Geld mit Deiner Homepage oder deinem Blog: Setzte eine Textlinkwerbung und bestimme den Preis selber.
Einfach kostenlos anmelden und einen Platz auf Deiner Homepage anbieten.
Make money with your homepage or blog: Set a text link advertising and declare the price.
Register free of charge and offer a place on your homepage.
Ein BenutzerBeitrag:
- Beiträge aktualisieren...
quickshiftin at gmail dot com
14.06.2008 8:29
note: you should not put a colon in the keys of the arrays you pass this method, it will do that for you.  and if you do put colons in the array keys, the resultant headers will have 2 colons beside one another.

so for example,
<?php
$httpRequest
->setHeaders('User-Agent' => 'Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2');
?>

will result in
User-Agent: Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2

<?php
$httpRequest
->setHeaders('User-Agent:' => 'Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2');
?>

will result in
User-Agent:: Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2



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",...)