给看下那边有错
程序员文章站
2022-06-08 08:47:49
...
给看下那里有错,
//防止乱码
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);
?>
//防止乱码
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);
?>
Curl
专题推荐
-
独孤九贱-php全栈开发教程
全栈 170W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
-
玉女心经-web前端开发教程
入门 80W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
-
天龙八部-实战开发教程
实战 120W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习
- 最新文章
- 热门排行
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论