[mapserver-users] How to achieve GetFeature request over a web proxy script PHP

Jörg Thomsen jt at mapmedia.de
Tue Jun 22 10:57:08 EDT 2010


Hello David,

David Alda Fernandez de Lezea wrote:
> Hi list,
>
> I'm trying to get data from a GetFeature request sent to MapServer,
> but when I do it through a php script, I get the error:
>
> <!-- MapServer version 5.6.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG
> OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ
> SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=FRIBIDI
> SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER
> SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER
> SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=RGBA_PNG
> INPUT=JPEG INPUT=POSTGIS INPUT=ORACLESPATIAL INPUT=OGR INPUT=GDAL
> INPUT=SHAPEFILE -->  <BODY BGCOLOR="#FFFFFF">  mapserv(): Web
> application error. Traditional BROWSE mode requires a TEMPLATE in the
> WEB section, but none was provided.
>
> But if I do it directly from JavaScript, without using the script, I
> get the data back without any problems??
>
> Here is my proxy-php-script:
>
> <?php  $strURL = $_REQUEST["url"]; $strMethod = $_REQUEST["method"];
> $strData = $_REQUEST["data"]; /*echo "Data -->  ".$strData; echo "URL
> -->  ".$strURL; echo "Method -->  ".$strMethod;*/
>
> $ch = curl_init($strURL); curl_setopt($ch, CURLOPT_URL, $strURL); if
> ($strMethod == "POST"){ curl_setopt($ch, CURLOPT_POST, true);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $strData); } $data =
> curl_exec($ch); curl_close($ch); ?>
>
> It seems that if I use the script, MapServer thinks that I'm
> requesting the data through a web browser, but if I do it directly
> from JavaScript, no. I'm confused.

no, browse means an old non-ogc-method of requesting maps from 
mapserver, nothing to do with internet browser 
(http://www.mapserver.org/mapfile/template.html). Usually you get this 
message if any WMS-request-parameter is missing, so mapsverver cannot 
identify your request as a wms-request. Might be the 'SERVICE=WMS'.

> Does anybody know how to achieve this task??

let php echo the whole request, you will see what is missing.

Jörg

>
> Thanks one more time.
>
>
>
> Un saludo,
>
> ··················································································
>
>  David Alda Fernández de Lezea Lurralde eta Biodibertsitate Saila /
> Dpto. de Territorio y Biodiversidad
>
> IKT Granja Modelo s/n · 01192 · Arkaute (Araba)
>
> ··················································································
>
>
Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
> ··················································································
>
>
email: dalda at ikt.es                                web: www.ikt.es
> ··················································································
>
>
_______________________________________________
> mapserver-users mailing list mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list