PHP模拟POST aspx页面不成功,该怎么解决

WBOY
发布: 2016-06-13 12:31:15
原创
883 人浏览过

PHP模拟POST aspx页面不成功
下面实例返回 是0|访问限制!请重新加载页面
应该放回-2|车牌号码错误



/************************************************************************
Name: POST 测试程序 Vesion: 1.0 Date: 2004-08-05
*************************************************************************/
$keyimg=$_POST['keyimg'];
if($keyimg){
????$flag = 0;
???? //要post的数据
????$argv = array(
????????'action'=>'Illagel',
????????'back4'=>'3248',
????????'headno'=>'粤',
????????'no'=>'LA9532',
????????'type'=>'02',
????????'validate'=>$keyimg????
????????);
????//构造要post的字符串
????foreach ($argv as $key=>$value) {
????????if ($flag!=0) {
????????????$params .= "&";
????????????$flag = 1;
????????}
????????$params.= $key."=";
????????$params.= urlencode($value);
????????//$params.= $value;
????????$flag = 1;
????}
????echo $params;
????$length = strlen($params);
???? //创建socket连接
????$fp = fsockopen("www.gdhzcgs.com",80,$errno,$errstr,10) or exit($errstr."--->".$errno);
????//构造post请求的头
????//$header = "POST /Illegal.aspx HTTP/1.1\r\n";
????$header = "POST /Ajax.aspx HTTP/1.1\r\n";
????$header .= "Host:www.gdhzcgs.com\r\n";
????$header .= "Referer:www.gdhzcgs.com/Illegal.aspx\r\n";
????$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
????$header .= "Content-Length: ".$length."\r\n";
????$header .= "Connection: Close\r\n\r\n";
????//添加post的字符串
????$header .= $params."\r\n";
????//发送post的数据
????fputs($fp,$header);
????$inheader = 1;
????while (!feof($fp)) {
????????$line = fgets($fp,1024); //去除请求包的头只显示页面的返回数据
????????if ($inheader && ($line == "\n" || $line == "\r\n")) {
???????????? $inheader = 0;
????????}
????????if ($inheader == 0) {
????????????echo $line;
????????}
????}
????fclose($fp);
}
else{
echo 'keyimg=空';
}
?>
nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">




网上车管所




PHP模拟POST aspx页面不成功,该怎么解决



相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!