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

David Alda Fernandez de Lezea dalda at ikt.es
Tue Jun 22 06:12:10 EDT 2010


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.

Does anybody know how to achieve this task??

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
··················································································


More information about the mapserver-users mailing list