Re: Re: talking to a web page

From: Date: Wed, 03 Dec 2003 22:36:42 +0000
Subject: Re: Re: talking to a web page
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-171738@lists.php.net to get a copy of this message
One last thing. If all you need to do is go to a page and not navigate it, you could just use HTTP_Request, upon which HTTP_Client is built. Then again, if you have multiple request to do and have to keep sending the auth data, the Client would be best. David T-G wrote:
Justin, et al -- ...and then Justin Patrin said... % % You can use PEAR's HTTP_Client package % (http://pear.php.net/package/HTTP_Client) to connect to a website, do % authentication, post forms, handle redirects, etc. It also keeps track % of cookies. Oh, goodie; that sounds great. % % Here's a sample (note that the URLs in this will probably not work): % % require_once('HTTP/Client.php'); % $client = &new HTTP_Client(array('user' => 'username', 'password' => % 'password')); That certainly seems easy enough. % $code = $client->post('http://www.example.com/script.asp',
%                       array('var1' = 'val1',
%                             'VAR2' => 'val2'));
OK, so I don't actually need to navigate the page but instead just fill in the fields and then send it. Very cool. % $code = $client->get('http://www.example.com/loginRequired.php'); Now to figure out how to try it out :-) Thanks & HAND :-D


« previous php.general (#171738) next »