PHP MapScript Wrappers for WxS Services

Maul, Andreas-Alexander Andreas-Alexander.Maul at BGR.DE
Wed Jan 31 05:45:19 EST 2007


Just after sending this mail I found the silly own mistake: the php script started with a newline in front of the opening php tag and ended with a newline after the closing php tag.
Stupid, stupid ...
Andreas

-----Ursprüngliche Nachricht-----
Von: Maul, Andreas-Alexander 
Gesendet: Mittwoch, 31. Januar 2007 10:33
An: MAPSERVER-USERS at LISTS.UMN.EDU
Betreff: PHP MapScript Wrappers for WxS Services

Hi, 
currently we try to use the PHP MapScript wrappers for WMS services according to the PHP examples in the howto document http://mapserver.gis.umn.edu/docs/howto/wxs_mapscript.

Unfortunately we experience with the PHP mapscript functions ms_iogetstdoutbufferstring() or ms_iogetStdoutBufferBytes() 
e.g. with

/*--------------------------------------------------*/ dl("php_mapscript_4.10.0.dll");

$request = ms_newowsrequestobj();
$request->loadparams();

/* Enable output buffer */
ms_ioinstallstdouttobuffer();

/* Create mapobject, execute request */
$oMap = ms_newMapobj("../mymap/wms.map");
$oMap->owsdispatch($request);

/* wich contenttype has been returned ? */
 $contenttype = ms_iostripstdoutbuffercontenttype();
 $ctt = explode("/",$contenttype);

/* Send response with appropriate header */
 if ($ctt[0] == 'image')
	{
	header('Content-type: image/'. $ctt[1]);
	ms_iogetStdoutBufferBytes();
	}
else
	{
	header('Content-type: application/vnd.ogc.wms_xml');
	ms_iogetStdoutBufferBytes();
	}

ms_ioresethandlers();
/*--------------------------------------------------*/

that there is at least one additional blank line at the beginning of the sent document between http-header and binary data (i.e. the image) which seems to result in an unreadable file.

Environment: W2003 Server, IIS 6, PHP 5.2, MapScript 4.10.0 from MS4W 2.2.1 (maptools.org)

Does anybody know a workaround for this problem?

Regards, 
Andreas



More information about the mapserver-users mailing list