cURL不适用于指定的站点

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);
?>

php.net also uses curl_setopt maybe ad that?

<?php
// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_resultado.asp");
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);
?>

not sure if it will work though

Please try the following:

$url = "http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_resultado.asp";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec ($ch);
curl_close($ch);

Detailed explanation here