note 36118 deleted from ref.com by cmb

From: Date: Sun, 30 Jun 2019 07:45:57 +0000
Subject: note 36118 deleted from ref.com by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-211415@lists.php.net to get a copy of this message
Note Submitter: court shrock ---- 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' ?>

« previous php.notes (#211415) next »