POST method to mapserv
akoel
akoel at YAHOO.COM
Fri Jul 29 03:19:35 PDT 2005
hi.
I want to call the mapserv with POST method (becuse I have a long parameter
list) from a php script. To do this I used the fsockopen() function. It
almost worked, but...
I got back the html page with some strange numbers and characters in it.
randomly...
It's really annoying. I cann't handle it and I couldn't fint the answer.
has anybody get any idea what went wrong?
I insert the important part of the source here
<?php
$url = 'http://localhost/cgi-bin/mapserv_44.exe';
$host= 'localhost';
$path= '/cgi-bin/mapserv_44.exe';
$params = "program=http://localhost/cgi-bin/mapserv_44.exe&".
"mode=browse&".
"zoom=1&".
"map=../htdocs/wis/wis.map";
$request="POST ".$path." HTTP/1.1n";
$request.="Host: ".$host."n";
$request.="Content-type: application/x-www-form-urlencodedn";
$request.="Content-length: ".(strlen($params)-0)."n";
$request.="Request-number: 1n";
$request.="Document-type: Requestn";
$request.="Interface-Version: Test 1.4n";
$request.="Connection: closen";
$request.="n";
$request.=$params."n";
$fp = fsockopen("localhost", 80, $errno, $errstr);
if (!$fp) {
echo "$errstr ($errno)<br>n";
}else{
fputs($fp, $request);
while(!feof($fp)) {
echo fgets($fp, 2048);
}
fclose($fp);
}
?>
thanks akoel
More information about the MapServer-users
mailing list