question about HTTP_client
| From: | Lassiege Hugo | Date: | Thu, 30 Jun 2005 15:20:50 +0000 |
| Subject: | question about HTTP_client | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-19848@lists.php.net to get a copy of this message | ||
I'm searching for example about HTTP_Client but I didn't find anything.
I made a litte test but it didn't work very well. Maybe I miss something.
$client =& new HTTP_Client();
$arrayParam ["login"] = "thing";
$arrayParam ["password"] = "thing";
$arrayParam ["submit"] = "Validate";
$res = $client->post ( "http://www.url.com",
$arrayParam);
if (!PEAR::isError($res))
{
$response1 = $client->currentResponse();
print_r ($response1 );
// if I find the string "Welcome", I am successfully logged, so I print the
ResponseBody
if ( strstr ( $response1['body'], "Welcome") != false )
{
echo $response1['body'];
}
}
The print_r give :
Array ( [code] => 200 [headers] => Array ( [Server] => Apache-Coyote/1.1 [server] =>
Apache-Coyote/1.1 [Pragma] => No-cache [pragma] => No-cache [Cache-Control] => no-cache
[cache-control] => no-cache [Expires] => Thu, 01 Jan 1970 00:00:00 GMT [expires] => Thu, 01
Jan 1970 00:00:00 GMT [Content-Type] => text/html;charset=ISO-8859-1 [content-type] =>
text/html;charset=ISO-8859-1 [Content-Length] => 1609 [content-length] => 1609 [Date] =>
Thu, 30 Jun 2005 15:16:47 GMT [date] => Thu, 30 Jun 2005 15:16:47 GMT [Connection] => close
[connection] => close ) [body] => )
As you can see, the body is empty.
Does anybody know where I can find an example about this class ?