| Author |
[PEAR] problem with HTTP_Client::post
|
|
| Fumiaki Kato 2005-10-28, 6:58 pm |
| Hi ;
I run myphpscript included the Client.php page.
when I call HTTP_Client::post I get this error Call to a member function
on a non-object in
HTTP/Client.php on line 214.
it calls _createRequest function and the function is entered in the Client.php.
I tried the dumping of all the variables but there are no null values.
any HELP ?
cheers
Kato
| |
| Leo Lutz 2005-10-28, 6:58 pm |
| Hey Kato,
> I run myphpscript included the Client.php page.
> when I call HTTP_Client::post I get this error Call to a member functio=
n
> on a non-object in
> HTTP/Client.php on line 214.
HTTP_Client::post won't work since post() is not a static function.
You have to create an HTTP_Client object and then use it.
$httpClient =3D new HTTP_Client();
$httpClient->post(...);
--Leo
| |
| Fumiaki Kato 2005-10-29, 7:56 am |
| Hi Leo,
thanks for the quick response!
I wrote a "test.php"
<?php
var_dump($_POST);
?>
then I post
$url="http://example.com/test.php";
$data="abc=123&cde=567";
$httpClient = new HTTP_Client();
$httpClient->post($url, $data);
What kind of method there is to receive the response?
any HELP again?
cheers
Kato
At 15:28 05/10/29, you wrote:
>
>Hey Kato,
>
>HTTP_Client::post won't work since post() is not a static function.
>You have to create an HTTP_Client object and then use it.
>
>$httpClient = new HTTP_Client();
>$httpClient->post(...);
>
>--Leo
| |
| Leo Lutz 2005-10-29, 9:56 pm |
| Hey Kato,
On 10/29/05, Fumiaki Kato <kato@f.email.ne.jp> wrote:
> Hi Leo,
> thanks for the quick response!
>
> I wrote a "test.php"
> <?php
> var_dump($_POST);
> ?>
>
> then I post
>
> $url=3D"http://example.com/test.php";
> $data=3D"abc=3D123&cde=3D567";
>
> $httpClient =3D new HTTP_Client();
> $httpClient->post($url, $data);
>
> What kind of method there is to receive the response?
>
I think you need to look at the package HTTP_Request. It will do POSTs
and return the results.
http://pear.php.net/manual/en/packa...ttp-request.php
--Leo
| |
|
|
| Leo Lutz 2005-10-30, 3:56 am |
| >
> I think you both need to refresh your memory of the docs:
> http://pear.php.net/manual/en/packa...-client.curren=
tresponse.php
>
Good catch, I was looking at the docs but somehow missed that. (Really
not sure how with a name that obvious... oh well.)
--Leo
|
|
|
|