Re: HTTP_Request
| From: | Alexey Borzov | Date: | Mon, 31 Jul 2006 19:23:55 +0000 |
| Subject: | Re: HTTP_Request | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24801@lists.php.net to get a copy of this message | ||
Hi,
Ian Warner wrote:
Is there any way to print out exactly what HTTP Request is posting? A sort of debug for this package?You can do echo $req->_buildRequest();
Also the PUT command how should the data to be sent be allocated to the send?It should be done via setBody() method (yeah, I know about the addBody() typo and it's already fixed in CVS). Please also note that RFC2616 states: 9.6 PUT The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. so the following code makes little sense, you should send the page content rather than some key-value pairs.
} elseif ($params['method'] == 'PUT') {
foreach ($url as $k) {
$req->addQueryString($k);
}
}