Try as I could, I canβt get curl to pass cookie PHPSESSID. I have a similar setup, which some others talked about, but I could not get any of the proposed solutions.
I have a page that sends a request for receipt pageA.php. pageA.phpsome information is required from pageB.phpthat is on another server, so I use curl. pageBmaintains the session state that I need to get from my page.
I can transfer other cookies with pageAbefore pageBand not in cookies PHPSESSID.
The following works (cookie comes on pageB):
$options[CURLOPT_COOKIE] = "myPHPSESSID=" . $sessionId;
It is impossible:
$options[CURLOPT_COOKIE] = "PHPSESSID=" . $sessionId;
(I create an array of $ options and pass it curl_set_opt_array)
In fact, the latter causes some error that I cannot recognize, since my call curl_execnever returns (and pageBnever reaches).
I tried to set the header instead of using CURLOPT_COOKIE, but also without success:
$options[CURLOPT_HTTPHEADER][] = "Cookie: myPHPSESSID=" . $sessionId;
above works fine but
$options[CURLOPT_HTTPHEADER][] = "Cookie: PHPSESSID=" . $sessionId;
no.
PHP clearly does not want me to manually set PHPSESSID. I am not sure if this is appropriate, but by no means on the page. I call start_session()(although I tried to do this and had the same results).
, () cookie pageB call set_session_id() - . , , , , , , . , pinging around, , , .
...