Open($userInfo);
// Create an instance of ResourceService and use that to open the
// current map instance stored in session state.
$resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
$map = new MgMap();
$map->Open($resourceService, $mapName);
$dwfVersion = new MgDwfVersion("6.01", "1.2");
$mappingService = $siteConnection->CreateService(MgServiceType::MappingService);
$mapAgentUri = 'http://' . $_SERVER['HTTP_HOST'] . '/mapguide/mapagent/mapagent.fcgi';
$byteReader = $mappingService->GenerateMap($map, $mapAgentUri, $dwfVersion);
// Now output the resulting DWF.
$outputBuffer = '';
$buffer = '';
while ($byteReader->Read($buffer, 50000) != 0)
{
$outputBuffer .= $buffer;
}
header('Content-Type: ' . $byteReader->GetMimeType());
header('Content-Length: ' . strlen($outputBuffer));
echo $outputBuffer;
}
catch (MgException $e)
{
$result = $e->GetExceptionMessage() . "
" . $e->GetDetails();
header('Content-Type: text/html');
header('Content-Length: ' . strlen($result));
echo $result;
}
?>