Re: HTTP_Clients and Files - Part 2

From: Date: Wed, 17 Nov 2004 17:12:38 +0000
Subject: Re: HTTP_Clients and Files - Part 2
References: 1 2 3 4 5  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15599@lists.php.net to get a copy of this message
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? 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'))); Thanks Andrew

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