I am making a CURL get request via php to another domain to get json value, but as i know curl uses temporary session, but how can i maintain all the browser session in curl request ? here is my code
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "http://api.json"); //api.json is displaying value from session
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
how can i maintain the browser session …
For this you need to store the cookie and in next request attach into the header that works .