PHP Wrapper to hide mapfile location
Pagurek,Debbie [NCR]
Debbie.Pagurek at EC.GC.CA
Thu Sep 29 12:59:02 PDT 2005
Hi all,
A developer at my office has written the following PHP wrapper to hide
the location of mapfiles. I have seen .asp scripts to do this but no PHP
scripts have been brought to attention until now so I thought I would
present this to the community for feedback.
I have tested this briefly.
Any comments anyone?
D. Pagurek
<?
function buildQueryString($theArray)
{
foreach($theArray as $key=> $value)
{
$finalString.= "&$key=".urlencode($value);
}
return $finalString;
}
if($_GET)
{
$strRequest = $_GET;
}
else
{
$strRequest = $_POST;
}
$strURL =
"http://theserver/cgi-bin/mapserv.exe?map=C:\ms4w\apps\chameleon\map\tes
t.map&".buildQueryString($strRequest);
ini_set('user_agent','MSIE 4\.0b2;'); // fake a browser request.
$handle = fopen($strURL, "r");
$contents = '';
if($handle)
{
while (!feof($handle))
{
$contents .= fread($handle, 8192);
}
fclose($handle);
}
echo $contents;
?>
More information about the MapServer-users
mailing list