AWS Flask session not persistent from PHP requests AWS Flask session not persistent from PHP requests flask flask

AWS Flask session not persistent from PHP requests


You need to tell curl to persist the cookies using a cookiejar.

Add the line below to the top of your file:

$cookieFileName = tempnam('/tmp','cookies.txt');

Then add the curl_setopt calls below to each of your calls:

curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFileName); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFileName);

This way, curl will store & re-use the cookies between requests.