I’ve been using Http-Cache following slim documentation…
It works very well in browser and ajax. output header is response 304 means it load from cache.
But, after I have test using php curl to call my api.
It seems http-cache not working for php curl or i do wrong to create function curl to work using http cache.
Here is my function curl to call the API:
function testCurlWithCache($url){
//open connection
$ch = curl_init($url);
//curl options
curl_setopt($ch, CURLOPT_HTTPHEADER,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
//execute response
$response = curl_exec($ch);
//close connection
curl_close($ch);
return $response;
}
Please help me to make curl work using http-cache. Thanks