stringToProxy($PROXY_STRING); $meta = $base->ice_checkedCast("::Murmur::Meta"); // Mapping function function mapTree2Model($tree) { $channels = array(); for ($i = 0; $i < count($tree->children); $i++) { $channels[] = mapTree2Model($tree->children[$i]); } $users = array(); for ($i = 0; $i < count($tree->users); $i++) { $users[] = $tree->users[$i]->name; } return array( 'name' => $tree->c->name, 'channels' => $channels, 'users' => $users ); } // Prepare JSON $tree = $meta->getServer(1)->getTree(); $json = json_encode(mapTree2Model($tree)); // Render response if (!empty($callback)) { echo $callback . '(' . $json . ');'; } else { echo $json; }