<?php
$CookieFile = dirname(__FILE__).'/firecookie.tmp';
if(isset($_POST['TextBox1'])){
header('Content-Type:text/html');
$a=trim($_POST['TextBox1']); //户号
$VIEWSTATE=$_POST['__VIEWSTATE'];
$VIEWSTATEGENERATOR=$_POST['__VIEWSTATEGENERATOR'];
$EVENTVALIDATION=$_POST['__EVENTVALIDATION'];
$p="__VIEWSTATE=".$VIEWSTATE."__VIEWSTATEGENERATOR=".$VIEWSTATEGENERATOR."__EVENTVALIDATION=".$EVENTVALIDATION."TextBox1=".$a; //用户名和密码也可以有表单输入来做
$ch = curl_init(); // 2. 设置选项,包括URL
curl_setopt($ch,CURLOPT_URL, "http://qfcx.bluefire.cn/");
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding:gzip,deflate,sdch',
'Accept-Language:zh-CN,zh;q=0.8',
'Host:qfcx.bluefire.cn',
'Origin:http://qfcx.bluefire.cn',
'Referer:http://qfcx.bluefire.cn/','User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36',
));
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $p);//提交查询信息
$s = curl_exec($ch);
var_dump($s);//输出结果
curl_close($ch);
unlink($CookieFile);
}else{
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>燃气查询</title>
<meta name="description" content="燃气查询">
<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="format-detection" content="address=no">
<link rel="stylesheet" href="/dhnews/css/jquery.mobile-1.3.2.min.css">
<script src="/dhnews/js/jquery-1.8.3.min.js"></script>
<script src="/dhnews/js/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<div data-role="header">
<h1>燃气费用查询</h1>
</div>
<div data-role="content">
<form id="form1" name="form1" method="post" action="">
客户编号:<input type="text" id="TextBox1" name="TextBox1"/>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value='/wEPDwUKMTgwNjQzNDQyOWRk9odDtY39wBSFsTRrg8\+eR3PrL/D5vVAWIKM+r53TMsQ=' />
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="CA0B0334" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value='/wEWAwK/sc/gCALs0bLrBgKM54rGBl2nOscCsgCEkx4huMXaJz2Xsg5/PyZI0il/h7YVcNnI'/>
<p></p>
<p></p>
<input type="submit" name="Button1" id="Button1" value="查询" />
</form>
</div>
<div data-role="footer">
<h1>定海山</h1>
</div>
</body>
</html>
<?php }?>
代码码的有点臭有点长,见谅,问题是这样的,我代码执行后返回错误信息
实际发送的是这样的
加号莫名其妙没了,这个怎么破要
附上目标站点:http://qfcx.bluefire.cn/ 编号:1就可以测试
楼上说的对,发送数据的时候对数据 urlencode一下子是最保险的
如果你了解
urlencode(" ") == "+"
urldecode("+") == " "
就应该知道问题出在哪了