Jump to content

noahbeach

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

noahbeach's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yeah that resolves that error, but then again thats because that function no longer does anything. But we know that you are correct in your assumption that I seem to be calling it wrong. Basically all I'm trying to do with this class is create a wrapper class for the Ice Murmur::Meta class. The Murmur::Meta class has a function called getBootedServers() that fetches a list of all currently running servers, its return value list (array) of interfaces for running servers. A working (without my wrapper class) example of calling this function is: <?php Ice_loadProfile(); try { $base = $ICE->stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502"); $meta = $base->ice_checkedCast("::Murmur::Meta"); //Fetch list of all booted servers, returns an Array echo $meta->getBootedServers(); } catch (Ice_Exception $ex) { print_r($ex); } ?> The $base = line creates a proxy to the Meta object, then the $meta = line narrows the proxy to the proper type. If the above works, I don't see where I'm calling it different from within my class?
  2. Closer! I was typing in that code when I checked and saw you had the same idea. With my code revised to match the suggested, I got the new error: I then added global $ICE; To the __construct function and now receive a similar error on my getBootedServers function: Current code: <?php class Meta { var $base; var $meta; function __construct() { Ice_loadProfile(); global $ICE; $base = $ICE->stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502"); $meta = $base->ice_checkedCast("::Murmur::Meta"); } // Returns an interface to the specific server function getServer($serverid) { return $this->meta->getServer($serverid); } function newServer() { return $this->meta->newServer(); } function getBootedServers() { return $this->meta->getBootedServers(); } function getAllServers() { return $this->meta->getAllServers(); } } $meta = new Meta(); echo $meta->getBootedServers(); ?>
  3. The Ice_loadprofile() seems to do the job for that. The following is part of the script provided as an example and works fine, returns "Array" since the data type that is returned from the function being echoed is an array. <?php Ice_loadProfile(); try { $base = $ICE->stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502"); $meta = $base->ice_checkedCast("::Murmur::Meta"); //Fetch list of all booted servers, returns an Array echo $meta->getBootedServers(); } catch (Ice_Exception $ex) { print_r($ex); } ?>
  4. I'm writing a PHP web interface for the open source VOIP server Murmur. Murmur uses the Ice RPC to communicate and Ice has php bindings. I'm getting the common t_variable error, which is usually associated with a misplaced semicolon or bracket, but this doesn't seem to be the case. I can't seem to figure it out and would love a second pair of eyes to see if I'm missing something. The following code throws the error on the "var $base = $ICE->stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502");" line, if that line is commented out it throws the error on the next line: <?php Ice_loadProfile(); class Meta { var $base = $ICE->stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502"); var $meta = $base->ice_checkedCast("::Murmur::Meta"); function getServer($serverid) { return $this->meta->getServer($serverid); } function newServer() { return $this->meta->newServer(); } function getBootedServers() { return $this->meta->getBootedServers(); } function getAllServers() { return $this->meta->getAllServers(); } } $meta = new Meta(); echo $meta->getBootedServers(); ?> The following code works as expected and produces "This works" <?php Ice_loadProfile(); class Meta { var $itWorks = "This works"; function getServer($serverid) { return $this->meta->getServer($serverid); } function newServer() { return $this->meta->newServer(); } function getBootedServers() { return $this->itWorks; } function getAllServers() { return $this->meta->getAllServers(); } } $meta = new Meta(); echo $meta->getBootedServers(); ?> Any help would be awesome!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.