I'm creating a client for protocol running over TCP/IP sockets,the protocol is request/respond but unlike HTTP, any party can initiate the request and get back respond. The protocol is session oriented and passes state between requests in its header fields. So I would like to build upon PHP native sessions management to manage sessions and avoid having to re-invent the wheel. But PHP sessions were build with http protocol in mind and assumes client capabilities related to sessions handling. For example
session_start();
The above line sends a session cookie to the browser or in case session.use_cookies='0' is set sends url parameter.
The question is now, is there way PHP can be forced to use session id given in the code at run time or retrieved from other storage locations to get current session data.
something like this.
//start session in index.php
session_start();
// somewhere in other pages
set_active_session_id('47f6ac750'); // magical function
$name = $_SESSION['name'] // works as normal
So, in other words, I want to use php sessions outside HTTP protocol.To be precise, on the CLI.