Aug 122012
Programming in php: Access violation error occured while connecting to a remote server using php on newest questions tagged php – Stack Overflow
I have the following code
<?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);
?>
The query results in a page with message
access violation, reason mask=!XB, virtual address=!XH, PC=!X
Obviously the problem is not with my code.The request creates some type of error in their page.Do anybody know what type of error is this and the reason for this,and how to do a working request avoiding the error?
See Answers
source: http://stackoverflow.com/questions/11924678/access-violation-error-occured-while-connecting-to-a-remote-server-using-php
Programming in php: programming-in-php
Recent Comments