views:

46

answers:

1

Hey Guys,

I am developing a REST API layer for my application using Zend_Rest_Controller. I have an authenticate method where the clients will pass the apikey and after the key is authorized I have to create a session (for which I'm using new Zend_Session_Namespace(<32 bit unique session key which I'm generating>)) which need to be retrieved in subsequent API calls where the client will pass the same session key which I generated in the previous step.

It looks like Zend uses PHPSESSID variable to retrieve the session object and since my clients use, curl there is no guarantee that the same request object will be used in subsequent calls.

In a nutshell - I want to generate a 32 bit unique string and then use that as a key to store the session object and then use that key to restore my session object in the next call. And in the process I don't want Zend to use the PHPSESSID variable.

Any help will be greatly appreciated!

Cheers

+2  A: 

The Zend_Session API documentation lists a setId method:

setId() - set an id to a user specified id

  • throws: Zend_Session_Exception
  • access: public static void setId (string $id)

  • string $id

karim79
That worked like charm! Thanks!
Jugs
For the benefit of others, Zend_Session::setId($session_id);Zend_Session::start(); $session = new Zend_Session_Namespace("Namespace");
Jugs

related questions