$cookie_jar = 'cookie.txt';
$data = array('mvfAdminMonths'   => array('200706','200707'),
              'mvfSiteProvinces' => 'Beijing', 
              'whichFirst'     => 'AS',
              '__act'        => '__id.22.SeatsQuery.adp.actList', 
  'submit.x'=> '28',
  'submit.y'=> '9'); 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,'http://toefl.etest.edu.cn/cn/SeatsQuery'); 
curl_setopt($ch, CURLOPT_POSTFIELDS,$data); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,false); 
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
echo curl_exec($ch);
sleep(30);
$data = array('mvfAdminMonths'   => '200706', 
'mvfAdminMonths'   => '200707',
              'mvfSiteProvinces' => 'Beijing', 
              'whichFirst'     => 'AS',
              '__act'        => '__id.22.SeatsQuery.adp.actList', 
  'submit.x'=> '28',
  'submit.y'=> '9'); 
$ch2 = curl_init(); 
curl_setopt($ch2, CURLOPT_URL,'http://toefl.etest.edu.cn/cn/SeatsQuery'); 
curl_setopt($ch2, CURLOPT_POSTFIELDS,$data); 
curl_setopt($ch2, CURLOPT_RETURNTRANSFER,false); 
curl_setopt($ch2, CURLOPT_COOKIEFILE, $cookie_jar); 
echo curl_exec($ch2);
curl_close($ch); 获取cookie要指定cookie文件位置类似于这样
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
指定获取cookie位置curl_setopt($ch2, CURLOPT_COOKIEFILE, $cookie_jar); 
指定要传送的cookie的位置

解决方案 »

  1.   

    装个isri 看看你登陆的网站所提交的地址和参数就知道了。抓问题重点才对
      

  2.   

    类似于这样
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
    指定获取cookie位置curl_setopt($ch2, CURLOPT_COOKIEFILE, $cookie_jar); 
    指定要传送的cookie的位置curl_setopt($ch, CURLOPT_NOBODY, true);
    curl_setopt这个函数你到php。net上看看,有很多使用用例可供你参考。