Re: HTTP_Clients and Files - Part 2

From: Date: Wed, 17 Nov 2004 18:59:47 +0000
Subject: Re: HTTP_Clients and Files - Part 2
References: 1 2 3 4 5 6  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15605@lists.php.net to get a copy of this message
On Wed, 17 Nov 2004 12:12:38 -0500, Andrew Nagy <asnagy@webitecture.org> wrote: > Justin Patrin wrote: > > > > On Tue, 16 Nov 2004 11:51:31 +0300, Alexey Borzov <borz_off@cs.msu.su> wrote: > > > >>Hi, > >> > >>Andrew Nagy wrote: > >> > >>>For some reason, this site isn't using cookies for it's sessions, > >>>it's > >>>passing the id in the query string and through hidden fields. > >>> > >>>So are you saying that I need to parse through the resulting HTML to > >>>pull out the id from a link or something? What if their is not link on > >>>the page and it is just a form? > >> > >>I'd suggest adding a Listener to the Client object when you do a login to this > >>site. That Listener will wait for "httpRedirect" event and extract a session > >>Id > >>from the event's data (which is really a redirect URL). That's a bit easier > >>and > >>less error-prone than parsing HTML. > >> > > > > > > Assuming there *is* a redirect then this should work well. Otherwise a > > simple preg really isn't all that bad. > > > > Well I guess it's not a redirect, the url just appears with a session id > on it. Anyway, I was able to "scrape" the session id out of the html. > Still don't like this incase of any html changes, there is no way or > interacting with the querystring after a post or get method? > Well, if there's no redirect, it can't give you a new URL...therefor yuo have to parse it out of the HTML. No way around that. If there *is* a redirect you can grab it from the rediection URL. > Anyway, my new question is how do i send an array of data in a post or > get method? For example, if the form that I am submitting to has a set > of checkboxes that are all the same name. > > $client->post($url, array('sessionid' => 'abc123', > 'options' => > array('1', '3', '7'))); > Hmmm... It's not really HTML compliant to have multiple checkboxes with the same name. It *is* possible with HTTP_Request using addRawPostData. I don't know if it's possible with HTTP_Client. -- Justin Patrin

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