downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

HttpRequest::addRawPostData> <HttpRequest::addPutData
[edit] Last updated: Fri, 24 May 2013

view this page in

HttpRequest::addQueryData

(PECL pecl_http >= 0.10.0)

HttpRequest::addQueryDataAdd query data

Описание

public bool HttpRequest::addQueryData ( array $query_params )

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

Affects any request type.

Список параметров

query_params

an associative array as parameter containing the query fields to add

Возвращаемые значения

Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.



add a note add a note User Contributed Notes HttpRequest::addQueryData - [1 notes]
up
1
Anonymous
4 years ago
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.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites