您好,欢迎访问一九零五行业门户网

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>
网上车管所
回复讨论(解决方案) 有curl不用非得自己造轮子,看着就蛋疼。
有curl不用非得自己造轮子,看着就蛋疼。
curl
http://www.gdhzcgs.com/ajax.aspx
也是 返回
0|访问限制!请重新加载页面
request headers value
(request-line) post /ajax.aspx http/1.1
x-requested-with xmlhttprequest
accept-language zh-cn
referer http://www.gdhzcgs.com/illegal.aspx
accept */*
content-type application/x-www-form-urlencoded
accept-encoding gzip, deflate
user-agent mozilla/5.0 (compatible; msie 9.0; windows nt 6.1; wow64; trident/5.0)
host www.gdhzcgs.com
content-length 69
connection keep-alive
cache-control no-cache
cookie asp.net_sessionid=rimtcb55pc2gcgurkaimgi45; cnzzdata3614737=cnzz_eid=42940778-1343020353-&ntime=1343020353&cnzz_a=0&retime=1343020354714&sin=<ime=1343020354714&rtime=0
有cookie呀..
找个httpwatch完全模拟访问过程..新手容易忽略 ajax 访问..
这个也需要模拟 很多session隐藏着 都是通过ajax秘密生成的,要把它挖出来..
更复杂点,有时还要看点它的js代码,木有办法的,跟着httpwatch完全模拟访问吧
我跨域访问也遇到同样的问题呀,晕,请问楼主最后是用什么方法解决的,同求?
其它类似信息

推荐信息