PHP類比POST aspx頁面不成功,該怎麼解決

來源:互聯網
上載者:User
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=空';
}
?>





網上車管所




分享到: 更多


------解決方案--------------------
Request HeadersValue
(Request-Line)POST /Ajax.aspx HTTP/1.1
x-requested-withXMLHttpRequest
Accept-Languagezh-CN
Refererhttp://www.gdhzcgs.com/Illegal.aspx
Accept*/*
Content-Typeapplication/x-www-form-urlencoded
Accept-Encodinggzip, deflate
User-AgentMozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Hostwww.gdhzcgs.com
Content-Length69
ConnectionKeep-Alive
Cache-Controlno-cache
CookieASP.NET_SessionId=rimtcb55pc2gcgurkaimgi45; CNZZDATA3614737=cnzz_eid=42940778-1343020353-&ntime=1343020353&cnzz_a=0&retime=1343020354714&sin=&ltime=1343020354714&rtime=0

有Cookie呀..
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.