Re: Question regarding HTTP_Request
| From: | Justin Patrin | Date: | Fri, 23 Jul 2004 04:10:46 +0000 |
| Subject: | Re: Question regarding HTTP_Request | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13814@lists.php.net to get a copy of this message | ||
On Thu, 22 Jul 2004 23:59:32 -0400, Alex Shi <chpshi@stonix.com> wrote:
> I can use HTTP_Request to simulate a login. I know that if
> login is correct, the remote site will return a cookie, and the
> url will be changed/redirected to a new location. So if I know
> the correct uid/pwd and the new location's url, there will be
> no problem, because I can just send a request to the new
> location.
>
> However, the problem is, if login is incorrect, the site will also
> return a cookie, and the url will be redirect another location.
> So, if I don't know if the uid/pwd is correct, how can check
> login result?
>
> All I know about this package's methods are as following:
>
> setURL (),
> setMethod (),
> addPostData (),
> addGetData (),
> sendRequest (),
> getResponseBody (),
> getResponseCookies (), and
> addCookie ().
>
> I cannot figure out with these methods how to get redirected
> response. Any one can suggest a solution?
> Thanks in advance!
>
Since you're planning on making multiple requests and dealing with a
cookie, use HTTP_Client. Get the response back and search for some
phrase in it (using strstr()) that means that the login failed.
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--