Re: Re: HTTP_Request
| From: | Justin Patrin | Date: | Tue, 25 Jul 2006 15:02:53 +0000 |
| Subject: | Re: Re: HTTP_Request | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-43569@lists.php.net to get a copy of this message | ||
On 7/25/06, Ian Warner <iwarner@triangle-solutions.com> wrote:
Further to this I need to POST some data without a Name
The docs say to use addBody but this doesnt exist - I have tried
addRawPostData also and the below
if ($params['method'] == 'POST') {
foreach ($url as $k => $v) {
$req->setBody($k);
}
each time it errors and says it cant open the URL.
again would be nice if I could see what http_request is actually posting.
You sent each of these e-mails twice.
addRawPostData() is the function you want.
You can use a listener. See the examples/listener class.
Ian Warner wrote: Hi Is there any way to print out exactly what HTTP Request is posting? A sort of debug for this package? Also the PUT command how should the data to be sent be allocated to the send?-- Justin Patrin// If method is POST then use the addPostData otherwise itshould be// addQueryString for GET command. if ($params['method'] == 'POST') { foreach ($url as $k => $v) { $req->addPostData($k, $v); } } elseif ($params['method'] == 'GET') { foreach ($url as $k => $v) { $req->addQueryString($k, $v); } } elseif ($params['method'] == 'PUT') { foreach ($url as $k) { $req->addQueryString($k); } }Cheers Ian -- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php