Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-12-2007, 11:30 AM   PM User | #1
eblackmo
New to the CF scene

 
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
eblackmo is an unknown quantity at this point
PHP and DCOM

I have the following code;

PHP Code:
<?php
    $objMetaFrameFarm 
= new COM("MetaFrameCOM.MetaFrameFarm");
    
$objMetaFrameFarm->Initialize(1);
    
    
$objTheSessions $objMetaFrameFarm->Sessions;
        
    print 
$objMetaFrameFarm->FarmName;
    
$objMetaFrameServers $objMetaFrameFarm->Servers;
    
    try
    {
        
        foreach(
$objMetaFrameServers as $objMetaFrameServer)
        {
            echo 
$objMetaFrameServer->ServerName;
        }
    }
    catch (
com_exception $x)
    {
        print 
$x "\n";
    }
    
?>
If I run it as is I get a http 500 error if I comment out the foreach the code seems to run fine. If I then add
PHP Code:
$count $objTheSessions->Count
inside the try it throws the following useful exception;

exception 'com_exception' with message 'Source: Unknown
Description: Unknown' in C:\Inetpub\wwwroot\Citrix_test_again.php:19 Stack trace: #0 C:\Inetpub\wwwroot\Citrix_test_again.php(19): unknown() #1 {main}

Count is a property of the Sessions object.
PHP Code:
print $objMetaFrameFarm->FarmName
works correctly and is output to the browser.

I was under the impression that foreach allows you to traverse a collection like for each in vb but this does not seem to be the case the sessions object does implement a _NewEnum property which returns an enumerator (ienumvariant) object for the collection I'm having some difficulty with the syntax though......

Does anyone have any suggestions? Thanks.
eblackmo is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:58 AM.


Advertisement
Log in to turn off these ads.