I have used CURL with PHP, please check the below code
$cookie = "cookies.txt";
file_put_contents($cookie, "");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
After that I opened the cookies.txt
file, in that the cookies are stored.
Now how do I read that file to get required content.
I have tried to read the file using readfile
file_get_contents
but no use at all, these are just returning empty string.
Please help me out.
Thanks in advance