views:

53

answers:

2

Hi,

Please any one tell me will webservice using nusoap helps to Pass PHP Session one site to other site. I need to pass the user session to my other site using PHP/Ajax/SOAP call

A: 

Depends... If you use cookies to send the sessionid from the user to the server, no. Since the browser won't send the cookie to a different domain than what it was originated from.

You can however send the sessionID as a parameter in the ajax call. But this will only work if the other site have access to the session data. Eg. same server and session data is in /tmp

Thomas Winsnes
+1  A: 

This is pretty easy with a callback (here we have server1 as origin, as server2 as server to redirect to):

  • From server1, redirect user to http://server2/auth_from_server1.php?id=12345
  • On server2 (internally, in the PHP code of auth_from_server1.php), do a request to http://server1/secret/check_session_id.php with the ID, 12345.
  • On server1, in the implementation of check_session_id.php, validate the ID and return OK, FAILURE, and session related data you want to pass, such as username, ...
  • On server2, when the call returns with OK, store the transferred session data, and give the user a cookie and session for this server.
wump
thanks for your answer
VAC-Prabhu