문제

Before talking about my issue I will shortly describe the project I am working on.

On one hand I am wokring on an API (based on symfony 2.x). This API is (will be) used by a website and smartphone apps and will handle all the requests that I need to do on my database.

On the other hand I am developing a website (also based on symfony 2.x). Within this website I am using curl to do the requests on the API.

I am sending a curl request to login and another one just after to get some data (I need to be logged in to get that data). I am keeping the same handler for all my requests (so the connection to the API is normally not lost).

So, the problem is that after I've logged in, the second request I sent I'm getting an error saying that I need to be logged in to do that. After research I found out that the sessions are different (different session id's) for each of the requests so naturally all information about the logged user is lost.

I was thinking that as the connection isn't closed between those two requests the session should have been the same.

Do you guys have any idea of why this is happening ?

Thank you for your help,

도움이 되었습니까?

해결책 2

Problem solved.

I found out that the API wasn't setting the PHPSESSID cookie in the response header.

Anyway, thank you for your help

다른 팁

TODO

  • be sure to have session_start();
  • check whether $_SESSION array is
  • not overwritten somehow you must redirect to the same domain. check
  • session_save_path and permissions on it
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top