欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

给看下那边有错

程序员文章站 2024-04-06 16:02:07
...
给看下那里有错,
//防止乱码
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

网友评论

文明上网理性发言,请遵守 新闻评论服务协议

我要评论
  • 给看下那边有错
  • 专题推荐

    作者信息
    给看下那边有错

    认证0级讲师

    推荐视频教程
  • 给看下那边有错javascript初级视频教程
  • 给看下那边有错jquery 基础视频教程
  • 视频教程分类