PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTTP » HTTP_Client » Bug #2079

parameters set using setRequestParameter don't get sent in the get function

Details

Submitted2004-08-07 14:01 UTC
Fromthesaur at php dot net
StatusBogus
PackageHTTP_Client
PHP Version4.3.4
OSLinux
Roadmaps(Not assigned)

Comments

[2004-08-07 14:01 UTC] thesaur at php dot net

Description:
------------
If you run these scripts, the expected output is that the querystring should contain the parameters. In fact, it does not. To pass querystring parameters, they must be supplied as a parameter to get(). This is counter-intuitive. I have not tested this on other releases of php, but I assume the behavior will be no different.

It might also be a good idea to make an easy way to separate POST and GET parameters, as it is likely that someone will want to use it on a site that uses both (posting to a URL that contains a querystring). Of course, it is also possible to simply add it to the request URL manually.

Reproduce code:
---------------
http_client_test.php:
<?php
require_once ('HTTP/Client.php');
$req = &new HTTP_Client();
$req->setRequestParameter('foo', 'bar');
$req->setRequestParameter('test', 1);
$req->setRequestParameter('tester', 'me');
$req->setDefaultHeader('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)');
$req->get('http://localhost/test.php');
$response1 = $req->currentResponse();
echo $response1['body'];
?>

test.php:
<?php
echo '<pre>';
print_r ($_SERVER);
?>