Re: HTTP_Client: samples?
| From: | Alexey Borzov | Date: | Fri, 04 Jun 2004 10:02:16 +0000 |
| Subject: | Re: HTTP_Client: samples? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12892@lists.php.net to get a copy of this message | ||
Hi!
Robert wrote:
someone can provide an example of how to correctly use the HTTP_Client class? I want to be able sending form data to a site and don't understand how to use the updateCookies function.You usually don't use it directly.
What I have so far and works: require_once("../inc-php/head.php"); require_once 'HTTP/Client.php'; $data = array( "username" => $_SESSION["sUsername"], "password" => $_SESSION["sPw"], "redirect" => "", "login" => "Log In" );That's done automagically. Just use Client to request the page you want after this, you are considered logged in by the site.$sUri = $aMyGlobals["sHttpHost"]."/phpBB/login.php";$client =& new HTTP_Client();$code = $client->post($sUri, $data);$response = $client->currentResponse(); echo $response['body']; Now I need to be able to store the cookies from login.php.