尝试使用curl_setopt从站点URL检索结果

I could not get the expected results, I kept loading the index page rather than pPOST the values to retreive the expected data

I have tried to change the $url='http://eworld.nabtebnigeria.org/results.asp' The form action on the actual page is action='results.asp'

<?php
function get_nabteb($examtype, $year,  $serial, $pin, $examno){
$url="http://eworld.nabtebnigeria.org/";    
$fields=array(
'candid' => urlencode(trim($examno)),
'examtype' => urlencode($examtype),
'examyear' => urlencode($year),
'serial' => urlencode($serial),
'pin' => urlencode($pin),
'emailcheck' => urlencode('1'),
'email' => urlencode(''),
'testcookie' => '1',
);

//print_r($fields);


    $ch = curl_init();

 $header[0] = "Accept: text/html, text/xml,application/xml,application/xhtml+xml,";
    $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
    $header[] = "Cache-Control: max-age=0";
    $header[] = "Connection: keep-alive";
    $header[] = "Keep-Alive: 300";
    $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
    $header[] = "Accept-Language: en-us,en;q=0.5";
    $header[] = "Pragma: no-cache";
    $header[] ="Content-Type: application/x-www-form-urlencoded";
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

    curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt( $ch, CURLOPT_COOKIESESSION, true );
  curl_setopt($ch,CURLOPT_COOKIEJAR, '/tmp/cookie.txt');
curl_setopt($ch,CURLOPT_COOKIEFILE,'/tmp/cookie.txt');

    echo $page = curl_exec($ch);

    echo $head = curl_getinfo($ch, CURLINFO_HEADER_OUT);
    echo curl_errno($ch) . '-' . curl_error($ch);
    //debug($head);
    //debug($page);

    curl_close($ch);
    return $page;
}
echo get_nabteb('01', '2013', 'NBRC14000856', '157328532669', 23062062);
?>