Why does my curl not working correctly?
$ch = curl_init("http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_resultado.asp");
curl_exec($ch);
curl_close($ch);
Why does my curl not working correctly?
$ch = curl_init("http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_resultado.asp");
curl_exec($ch);
curl_close($ch);
I discover the solution. This link require authentication cookie:
<?php
$ch = curl_init();
$options = array(
CURLOPT_URL => 'http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_pesquisa_new.asp',
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 50,
CURLOPT_COOKIE => 'ASPSESSIONIDCSSRTDCR=KMKMJHPDIHNGBBLJFNGDJKGK; security=true',
CURLOPT_RETURNTRANSFER => true
);
curl_setopt_array($ch, $options);
$senaHtml = curl_exec($ch);
curl_close($ch);
?>