Re: Re: talking to a web page
| From: | David T-G | Date: | Wed, 03 Dec 2003 22:27:04 +0000 |
| Subject: | Re: Re: talking to a web page | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171734@lists.php.net to get a copy of this message | ||
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
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!