2

我有以下代码

<?php
function send_post($url,$data) {//sends data array(param=>val,...) to the page $url in post method and returns the reply string
    $post = http_build_query($data);
    $context = stream_context_create(array("http"=>array(
       "method" => "POST",
       "header" => "Content-Type: application/x-www-form-urlencoded\r\n"."Content-Length: ". strlen($post) . "\r\nUser-agent:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)r\n",  
       "content" => $post,
    ))); 
    $page = file_get_contents($url, false, $context);
    return $page;
}
$post_data=array();
$post_data['firstName'] = 'Name';
$post_data['lccp_trnno']='16348';
$post_data['lccp_month'] = '8';
$post_data['lccp_day']='12';
$post_data['lccp_srccode']='ktym';
$post_data['lccp_dstncode']='tvc';
$post_data['lccp_classopt']='1A';
$post_data['lccp_conc']='ZZZZZZ'; 
$post_data['lccp_age']='30';
echo send_post("http://www.indianrail.gov.in/cgi_bin/inet_frenq_cgi.cgi",$post_data);
?>

查询产生一个带有消息的页面

access violation, reason mask=!XB, virtual address=!XH, PC=!X

显然问题不在于我的代码。请求在他们的页面中创建了某种类型的错误。有人知道这是什么类型的错误及其原因,以及如何做一个工作请求来避免错误?

4

1 回答 1

1

使用以下答案中列出的所有字段,包括“classopt”和“lcp_frclass1”

 <FORM NAME="FareInfo" METHOD="POST" ACTION="http://www.indianrail.gov.in/cgi_bin        /inet_frenq_cgi.cgi"><td>
 <INPUT TYPE="SUBMIT" NAME="lccp_submitfare" CLASS="btn_style" ONCLICK="return submitfare()"  VALUE="Get Fare">
 <INPUT  TYPE="HIDDEN" NAME="lccp_trnno" SIZE="5" VALUE="12635">
 <INPUT  TYPE="HIDDEN" NAME="lccp_srccode" SIZE="4" VALUE="MS  ">
 <INPUT  TYPE="HIDDEN" NAME="lccp_dstncode" SIZE="4" VALUE="MDU ">
 <INPUT  TYPE="HIDDEN" NAME="lccp_month" SIZE="2" VALUE="3">
 <INPUT  TYPE="HIDDEN" NAME="lccp_day" SIZE="2" VALUE="8">
 <INPUT  TYPE="HIDDEN" NAME="lccp_year" SIZE="4" VALUE="2013">
 <INPUT  TYPE="HIDDEN" NAME="lccp_age" SIZE="2" VALUE="ADULT_AGE">
 <INPUT  TYPE="HIDDEN" NAME="lccp_conc" SIZE="6" VALUE="ZZZZZZ">
 <INPUT  TYPE="HIDDEN" NAME="lccp_classopt" SIZE="2" VALUE="ZZ">
 <INPUT  TYPE="HIDDEN" NAME="lccp_frclass1" SIZE="2" VALUE="2S">
 <INPUT  TYPE="HIDDEN" NAME="lccp_frclass2" SIZE="2" VALUE="ZZ">
 <INPUT  TYPE="HIDDEN" NAME="lccp_frclass3" SIZE="2" VALUE="ZZ">
 <INPUT  TYPE="HIDDEN" NAME="lccp_frclass4" SIZE="2" VALUE="ZZ">
 <INPUT  TYPE="HIDDEN" NAME="lccp_frclass5" SIZE="2" VALUE="ZZ">
 <INPUT  TYPE="HIDDEN" NAME="lccp_frclass6" SIZE="2" VALUE="ZZ">
 <INPUT  TYPE="HIDDEN" NAME="lccp_frclass7" SIZE="2" VALUE="ZZ">
 <INPUT  TYPE="HIDDEN" NAME="lccp_disp_avl_flg" SIZE="1" VALUE="1">
 <INPUT  TYPE="HIDDEN" NAME="lccp_enrtcode" SIZE="4" VALUE="NONE">
 <INPUT  TYPE="HIDDEN" NAME="lccp_viacode" SIZE="4" VALUE="NONE">
 </FORM>
于 2013-03-08T12:52:50.850 回答