note 36118 added to ref.com

From: Date: Fri, 26 Sep 2003 09:24:33 +0000
Subject: note 36118 added to ref.com
Groups: php.notes 
Request: Send a blank email to php-notes+get-57162@lists.php.net to get a copy of this message
took me a while until I found out how to loop through COM objects in PHP.... in ASP, you use something like: <% set domainObject = GetObject("WinNT://Domain") for each obj in domainObject Response.write obj.Name & "<br>" next %> I finally found a note in a PHP bogus bug report that said you needed to do something like this (this is using ADSI): <?php $adsi = new COM("WinNT://Domain"); while($obj = $adsi->Next()) { echo $obj->Name.'<br>'; }// while // will list all the names of all objects in the domain 'Domain' ?> Also, you can access the IIS metabase by doing something like the following: <?php $iis = new COM("IIS://localhost/w3svc"); while($obj = $iis->Next()) { if ($obj->Class == 'IISWebServer') { $site = new COM("IIS://Localhost/w3svc/".$obj->Name); echo 'serviceID ('.$obj->Name.'): '.$site->ServerComment.'<br>'; $bindings = $site->ServerBindings; echo '<ul>'; foreach($bindings as $binding) { list($ip, $port, $hostHeader) = explode(':', $binding); echo "<li>$ip:$port -- $hostHeader</li>"; }// foreach echo '</ul>'; // hint: ssl bindings are in $site->SecureBindings unset($site); }// if }// while unset($iis); // will list all the sites and their bindings on 'localhost' ?> ---- Manual Page -- http://www.php.net/manual/en/ref.com.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36118 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36118&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36118&report=yes

« previous php.notes (#57162) next »