Re: [sessions] using [sockets]. Very tough!
| From: | N. F. Singh | Date: | Thu, 29 May 2003 16:20:07 +0000 |
| Subject: | Re: [sessions] using [sockets]. Very tough! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149448@lists.php.net to get a copy of this message | ||
Good point. However, the whole point is that I need to pass that session ID
so that TST2 can access the same session info TST1 is. Know what I mean? I
wonder how I can resolve this...
Thanks for the reply!
----- Original Message -----
From: "Marek Kilimajer" <kilimajer@webglobe.sk>
To: "Nicholas F. Singh" <nf_singh@ieee.org>
Cc: <php-general@lists.php.net>
Sent: Thursday, May 29, 2003 11:11 AM
Subject: Re: [PHP] [sessions] using [sockets]. Very tough!
>
> Nicholas F. Singh wrote:
>
> >Hello all you great PHPers,
> >
> >Who among you can solve this tricky problem?
> >
> >OK, a little background: my goal is to send local POST requests to some
of my php pages from **within** a php program. I have already successfully
done simple POST data transfers with sockets using "HTTPClient.class". This
is not an issue. This class really just prints out the appropriate headers
and receives a server response using sockets -- rather simple.
> >
> >I am now trying to get php SESSIONS to work with this socketed setup. I
already have sessions working for "normal" HTTP requests. You can pass
session IDs using cookies or with a POST/GET variable, as you know.
> >
> >Now, I've set up two files, "tst1.php" and "tst2.php". TST1 sends
> >TST2
some POST data, and attempts to relay the session id to maintain session
state:
> >
> >#### tst1.php ####
>
>---------------------------------------------------------------------------
-----------------------
> >include("HTTPClient.class");
> >session_save_path("mypathtosessions"); //No, this is not what I actually
have in my code, silly
> >session_start(); //Executes a new session.
> >
> >//Create socket object
> >$HTTP = new Net_HTTP_Client("mydomain",80); //No, this is not what I
actually have in my code, silly
> >
>
>///////////////////////////////////////////////////////////////////////////
////////////////////////////
> >// (1) GET - This example attempts to send the session ID via the GET
method. If you execute the code below,
> >// it will "lock" up. However, if you change "PHPSESSID" to, say,
> >"blah",
the code will not lock up.
> >// There's some problem, here!
> >$HTTP->Post("/~refcoord/tst2.php?PHPSESSID=".session_id(), // <--
> >
array( "Bob" => "Jones",
> >
"ID_we_need_to_pass_to_tst2" => session_id()
>
));
> >
> Sure it will lock up. tst1.php has the session file locked for itself,
> and as you use the same session id, the same session file would be used
> for tst2.php. You can use different session_save_paths for each file. Or
> you can let tst2.php set its own session id and get the cookie.
>
>
>
>