Re: [sessions] using [sockets]. Very tough!
| From: | Marek Kilimajer | Date: | Thu, 29 May 2003 16:24:53 +0000 |
| Subject: | Re: [sessions] using [sockets]. Very tough! | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149452@lists.php.net to get a copy of this message | ||
You can do:
session_start();
$session_id = session_id();
session_write_close();
Lock has been released, now you are free to post $session_id to the other script
N. F. Singh wrote:
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: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.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 somealready have sessions working for "normal" HTTP requests. You can pass session IDs using cookies or with a POST/GET variable, as you know.I am now trying to get php SESSIONS to work with this socketed setup. Isome POST data, and attempts to relay the session id to maintain session state:Now, I've set up two files, "tst1.php" and "tst2.php". TST1 sends TST2-----------------------#### tst1.php ####---------------------------------------------------------------------------have in my code, sillyinclude("HTTPClient.class"); session_save_path("mypathtosessions"); //No, this is not what I actuallyactually have in my code, sillysession_start(); //Executes a new session. //Create socket object $HTTP = new Net_HTTP_Client("mydomain",80); //No, this is not what I///////////////////////////////////////////////////////////////////////////////////////////////////////method. If you execute the code below,// (1) GET - This example attempts to send the session ID via the GETthe code will not lock up.// it will "lock" up. However, if you change "PHPSESSID" to, say, "blah",array( "Bob" => "Jones", "ID_we_need_to_pass_to_tst2" => session_id() ));// There's some problem, here! $HTTP->Post("/~refcoord/tst2.php?PHPSESSID=".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.