PHP MapScript Wrappers for WxS Services

Maul, Andreas-Alexander Andreas-Alexander.Maul at BGR.DE
Wed Jan 31 04:32:46 EST 2007


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