WonderLand
WonderLand

Reputation: 5674

php: Session data lost

I'm using php Session to store value on a server during an API call.

The issue here is that on my local server is working fine while on live server nothing is store in the session.

This is the work flow, basically I have an indipendent script calling Magento API :

[Script calling API ] -> [Magento Server]

On Magento side:

  1. the API is called
  2. API set some value in a session
  3. an observer try to read these value

The strange thing is that if I run my API call to on my local Magento server (copy of DEV), everything is fine while calling Magento DEV server, session var are empty.

This is how I'm setting the session value:

Mage::getSingleton('admin/session')->setApiQuoteId($quoteId); 

However I'm quite sure code part is ok ( as it works fine here ) my doubt are:

  1. Can I use session with out using a browser but a script/API call to access server ?
  2. Any server setting can broke the above functionality ?

Local server: PHP - 5.4.6

Dev Server: PHP - 5.2.17

Upvotes: 0

Views: 377

Answers (1)

Xnoise
Xnoise

Reputation: 522

Sessions are identified by a cookie. If your api cannot hold a cookie and send it everytime, you will loose the session variables everytime because a new session will be allocated.

Upvotes: 1

Related Questions