So I use cURL to get data from page 1, fetch info from it and store it in an array. The next step is to load the next page, I do this by creating a new cURL with the same cookiejar and cookiefile. I see the page 1 correctly but page 2 displays: Session not found. Session may have expired. By looking at the header information I see that in page 1 it sets the cookie WCOOKIE=rd244o00000000000000000000ffff912c10f5o80.
In the headers of page 2 it sets the cookie WCOOKIE=rd244o00000000000000000000ffff912c10f6o80.
So this is why it thinks the session is expired, it doesn't load the cookie but the page tries to rewrite it. So my question: What must I do to let page 2 load the cookie set by page 1 instead of trying to set a new cookie?
Additional information: the loading of the two pages both happens in one file (1.php) because I need to store both the data in 1 array, and you need the cookie from page 1 to be able to request page 2.
Both pages are set to use headers:
$headers[] = "Accept: */*";
$headers[] = "Connection: Keep-Alive";
$headers[] = "Content-type: application/x-www-form-urlencoded;charset=UTF-8";
Loading page 1:
$cSession = curl_init();
$tmpfname = dirname(__FILE__).'/cookie.txt';
curl_setopt($cSession, CURLOPT_COOKIEJAR, $tmpfname);
curl_setopt($cSession, CURLOPT_COOKIEFILE, $tmpfname);
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
curl_setopt ($cSession, CURLOPT_COOKIESESSION, TRUE);
Loading page 2:
$ch = curl_init ();
$tmpfname = dirname(__FILE__).'/cookie.txt';
curl_setopt($ch, CURLOPT_COOKIEJAR, $tmpfname);
curl_setopt($ch, CURLOPT_COOKIEFILE, $tmpfname);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt ($ch, CURLOPT_COOKIESESSION, TRUE);
This ain't all the settings but I'm guessing I have to change something in these lines, if more info is needed please let me know and i'll post them.
Help much appreciated :)