I run followed test to verify my code working properly:
curl -L -i -X POST -d 'json={"orderBy":0,"maxResults":50}' http://mysite.com/ctlClient/
I call: http://mysite.com/ctlClient/index.php:
session_unset();
session_start();
//pass data to _SESSION
foreach($_POST as $key => $value){
$_SESSION[$key] = $value;
}
// redirect to `/fwf/online/index.php`
ctlGotoSameDomain("/fwf/online/");
After redirect, I call /fwf/online/index.php
:
<?php
session_start();
....
class fwfOnline {
public function __construct() {
msqLogFile('test/test_max',$_SESSION);
// here is my problem, $_SESSION is empty, :(
$this->json = isset($_SESSION['json']) ? $_SESSION['json'] : null;
global $gConfig;
if ($gConfig['soapDebug'])
msqLogFile("fwf/post", Array('post' => 'Request: '.$this->json));
$this->response = $this->getResponse();
echo $this->response;
}
....
In logs from mysite.com/ctlClient/index.php
I see that $_SESSION has data
but in /fwf/online/index.php
its empty.
Can someone tell me what did i miss?
Thank you,
[EDIT] From @rr-
I printed both session IDs and got difference:
"2013-07-05 09:44:31","Session ID: ihpfs1skrp792gncgancb02516"
"2013-07-05 09:44:31","Session ID: tp6ejtl1tj9bigrgsi3jt6h9a1"
why its happened?
[FIX]
Regards to @rr-
answer I found the problem,
I need to add -b
to my script to enable the cookies. CURL by default doesn't use them and this issue caused to session ID problem.
Thank you rr-