给看下那里有错,
//防止乱码
header("Content-type:text/html;charset=UTF-8");
$discuz_url = 'http://www.uuxoo.com/ ';//地址
//$login_url = $discuz_url .'/violat/query/';//地址
$url="http://www.uuxoo.com/violat/query/";
//$cookie_file = tempnam('./temp','cookie');
$ch = curl_init($url);
//echo $login_url;
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
$contents = curl_exec($ch);
curl_close($ch);
//获取表单FORMHASH
preg_match('//i', $contents, $matches);
if(!empty($matches)) {
$formhash = $matches[1];
} else {
die('Not found the forumhash.');
}
//?vehicle_reg_no=E1Y121&vehicle_id_no=153313&have_submit=yes&submit=1&vehicle_area=赣&vehicle_type=02
$post_data = array();
//车牌号
$post_data['vehicle_reg_no'] = 'E1Y121';
//车架号
$post_data['vehicle_id_no'] = '153313';
$post_data['have_submit'] = "yes";
$post_data['submit'] = '1';
//汽车地址
$post_data['vehicle_area'] = '赣';
//帖子的hash码,这个非常关键!假如缺少这个hash码,discuz会警告你来路的页面不正确
$post_data['formhash']=$formhash;
//汽车类型
$post_data['vehicle_type'] = '02';
$aaa= $formhash;
echo $aaa;
//$urlss="http://www.uuxoo.com/violat/query/?vehicle_reg_no=E1Y121&formhash=$aaa&vehicle_id_no=153313&have_submit=yes&submit=1&vehicle_area=赣&vehicle_type=02";
//echo $urlss;
$chs = curl_init($url);
//curl_setopt($ch, CURLOPT_REFERER, $url); //伪装REFERER
curl_setopt($chs, CURLOPT_HEADER, 0);
curl_setopt($chs, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
//curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($chs, CURLOPT_POST, 1);
curl_setopt($chs, CURLOPT_POSTFIELDS, $post_data);
echo curl_exec($chs);
//echo "$ch";
curl_close($chs);
?>