elhelaly1999 Posted July 21, 2008 Share Posted July 21, 2008 Hi , how can I use session in my web service ? if I use web service like this web service server : <?php function greet($param) { session_start() ; $_SESSION['id'] = "hiiiiiiii" ; $retval = '<a href="test2.php">Go to page print my session variable</a>'; return new SoapParam($retval, 'greetReturn'); } $server = new SoapServer(null, array('uri' => 'http://localhost/test')); $server->addFunction('greet'); $server->handle(); ?> I found that session start and putting my variable into the session with this way not working but I can't find how can I make it work ? Can I find help here ? Link to comment https://forums.phpfreaks.com/topic/115824-webservice-and-session/ Share on other sites More sharing options...
samshel Posted July 21, 2008 Share Posted July 21, 2008 what are you trying to achieve exactly? trying to set a session in a web service call and use the same value when you click on some page?? if yes, that wont work..please excuse if i got it wrong. Link to comment https://forums.phpfreaks.com/topic/115824-webservice-and-session/#findComment-595416 Share on other sites More sharing options...
elhelaly1999 Posted July 21, 2008 Author Share Posted July 21, 2008 I try to store a variable in a session then get that variable from any page in my site Link to comment https://forums.phpfreaks.com/topic/115824-webservice-and-session/#findComment-595420 Share on other sites More sharing options...
samshel Posted July 21, 2008 Share Posted July 21, 2008 not possible, sessions set by one page/browser cannot be used by other pages..php is stateless so it wont work. Link to comment https://forums.phpfreaks.com/topic/115824-webservice-and-session/#findComment-595421 Share on other sites More sharing options...
elhelaly1999 Posted July 21, 2008 Author Share Posted July 21, 2008 Ok How can I built my session in web service (Using SOAP) ? Link to comment https://forums.phpfreaks.com/topic/115824-webservice-and-session/#findComment-595424 Share on other sites More sharing options...
samshel Posted July 21, 2008 Share Posted July 21, 2008 using sessions is not advised in web service as far as i know. you can use DB or files to store data, which you want to keep in session. Link to comment https://forums.phpfreaks.com/topic/115824-webservice-and-session/#findComment-595432 Share on other sites More sharing options...
elhelaly1999 Posted July 21, 2008 Author Share Posted July 21, 2008 why u not advise with it ? and now , I working in a system that user logged in and I should hold his ID to do operation with it the problem that system is web service not normal site How can I hold this ID with webservice ? Link to comment https://forums.phpfreaks.com/topic/115824-webservice-and-session/#findComment-595480 Share on other sites More sharing options...
redarrow Posted July 21, 2008 Share Posted July 21, 2008 use $_GET[] Link to comment https://forums.phpfreaks.com/topic/115824-webservice-and-session/#findComment-595504 Share on other sites More sharing options...
elhelaly1999 Posted July 22, 2008 Author Share Posted July 22, 2008 thanx redarrow But it not working another question : I want to know can web service save the session ? Link to comment https://forums.phpfreaks.com/topic/115824-webservice-and-session/#findComment-596269 Share on other sites More sharing options...
elhelaly1999 Posted July 22, 2008 Author Share Posted July 22, 2008 I just want to know can I save session in webservice ? Link to comment https://forums.phpfreaks.com/topic/115824-webservice-and-session/#findComment-596518 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.