note 91039 deleted from httprequest.addquerydata by sobak
| From: | sobak@php.net | Date: | Sun, 04 Dec 2016 07:26:53 +0000 |
| Subject: | note 91039 deleted from httprequest.addquerydata by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208109@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
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.