note 45996 modified in ref.com by tularis

From: Date: Sat, 25 Sep 2004 21:55:18 +0000
Subject: note 45996 modified in ref.com by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77323@lists.php.net to get a copy of this message
[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; // 'Width of the map in pixels $mMap->Height = 300; // 'Height of the map in pixels $mMap->BackColor = 15130848; $_SESSION['map'] = $mMap; } $resultRefresh = $mMap->Refresh(); //Refresh the map $urlImage = $mMap->GetImageAsUrl(); print "<br>urlImage=$urlImage<br>"; print "<br><IMG SRC='$urlImage'>"; /* $ArcIMSConnector->Release(); $ArcIMSConnector = null; $mMap->Release(); $mMap = null; */ ?> --was-- 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; // 'Width of the map in pixels $mMap->Height = 300; // 'Height of the map in pixels $mMap->BackColor = 15130848; $_SESSION['map'] = $mMap; } $resultRefresh = $mMap->Refresh(); //Refresh the map $urlImage = $mMap->GetImageAsUrl(); print "<br>urlImage=$urlImage<br>"; print "<br><IMG SRC='$urlImage'>"; /* $ArcIMSConnector->Release(); $ArcIMSConnector = null; $mMap->Release(); $mMap = null; */ ?> http://php.net/manual/en/ref.com.php

« previous php.notes (#77323) next »