PHP Doku:: Add query data - function.httprequest-addquerydata.html

Verlauf / Chronik / History: (1) anzeigen

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

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::addPutData

HttpRequest::addRawPostData>>

HttpRequest::addQueryData

(PECL pecl_http >= 0.10.0)

HttpRequest::addQueryDataAdd query data

Beschreibung

public bool HttpRequest::addQueryData ( array $query_params )

Add parameters to the query parameter list, leaving previously set unchanged.

Affects any request type.

Parameter-Liste

query_params

an associative array as parameter containing the query fields to add

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...
Anonymous
22.05.2009 3:52
Litte example :

/Tests/get.php :
========================
<?php
    header
('Content-Type: text/plain') ;
   
print_r($_GET) ;
?>
========================

/Tests/http.php :
========================
<?php
    header
('Content-Type: text/plain') ;
   
$request = new HttpRequest('http://127.0.0.1/Tests/get.php?foo=bar') ;
   
$request->addQueryData(array('baz' => 'qux')) ;
   
$response = new HttpMessage($request->send( )) ;
    echo
$response->getBody( ) ;
?>
========================

Run /Test/http.php display :
========================
Array
(
    [foo] => bar
    [baz] => qux
)
========================

So HttpRequest::addQueryData( ) deals with hard-coded GET data and complete them.



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