Im trying to take the cookie file from the webpage with PHP and CURL: https://www.receita.fazenda.gov.br/Aplicacoes/SSL/ATCTA/CPF/ConsultaSituacao/ConsultaPublica.asp
But after the first time i can´t take it more, the cookie is avaliable in the "RESPONSE HEADER" just in the 1º connection, after the 1º connection it isn´t more.
I tried to make a CURL request cleaning the cache, or avoiding the cache, but i haven´t success.
So when i try to do it in the browser, what i noticed is that all the time i clean the cache i can see the cookie in the "RESPONSE HEADER", how can i do it using PHP + CURL, i need to get the cookie?
Thanks!
1º request after to clean cache browser
CODE:
define('COOKIELOCAL', realpath('./').'/');
$ch = curl_init("https://www.receita.fazenda.gov.br/Aplicacoes/SSL/ATCTA/CPF/ConsultaPublica.asp");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile);
/* trying to clean the cache */
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Pragma: no-cache",
"Cache-control: no-cache"
));
$result = curl_exec($ch);
echo 'Cookie...........:' . file_get_contents($cookieFile); // Empty cookie file here until now