[Editor's Note:
Serializing the object, storing it and then (on the next page) unserializing it WILL work.
End Note]
the big problem for PHP is it can't save in session an COM object
an samples code is here. This works just first time, then give the error:
Call to undefined method com::Refresh() on line $mMap->Refresh();
the reson is he can't save the object $mMap in session
<?php
session_start();
if (isset($_SESSION['map'])) {
$mMap = $_SESSION['map'];
}
else
{
$ArcIMSConnector = new COM ("aims.ArcIMSConnector") or die("can not create AIMS message object");
echo "Loaded ArcIMSConnector, <br>";
$ArcIMSConnector->ServerName = "map.sdsu.edu";
$ArcIMSConnector->ServerPort = 5300;
$mMap = new COM ("aims.Map") or die("can not create aims.Map message object");
echo "Loaded aims.Map, <br>";
print "AIMS-ServerName= $ArcIMSConnector->ServerName <br>";
$resultInit= $mMap->InitMap($ArcIMSConnector,"Worldgeography");
$mMap->Width = 400; $mMap->Height = 300; $mMap->BackColor = 15130848;
$_SESSION['map'] = $mMap;
}
$resultRefresh = $mMap->Refresh(); $urlImage = $mMap->GetImageAsUrl();
print "<br>urlImage=$urlImage<br>";
print "<br><IMG SRC='$urlImage'>";
?>