Re: Question regarding HTTP_Request

From: Date: Fri, 23 Jul 2004 04:26:34 +0000
Subject: Re: Question regarding HTTP_Request
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13815@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. > Yes I've read that package (you suggested to me two days ago) but found it hard to figure out how to use it. There's no adequate documents, and I am new to use pear...Anyway I will try again to understand it...If you can segguest me an example that will be great helpful.. Thanks! Alex

« previous php.pear.general (#13815) next »