List running Virtual Servers using PHP5

The following code uses ZXTM's Control API to list all the running virtual servers on a cluster. The code is written in PHP 5.


listVS.php

#!/usr/bin/php5
<?
   $conn = new SoapClient( "VirtualServer.wsdl",
      array( 'login' => "username",
         'password' => "password" ));
   $names = $conn->getVirtualServerNames();
   $enabled = $conn->getEnabled( $names );
   for ($i=0; $i < count( $names ); $i++) {
      if ( $enabled[$i] )
         print "$names[$i]\n";
   }
?>

Notes

You may need to enable the SOAP extensions in your php.ini file. Like Python, the PHP Soap toolkit expects to find the location of the SOAP server in the WSDL file, and does not provide any means to override it. However, you can specify the login details from your application, so these do not need to be embedded in the WSDL:

<service name="VirtualServer">
   <port name="VirtualServerPort"
         binding="zeusns:VirtualServerBinding">
      <soap:address location="https://host:9090/soap" />
   </port>
</service>

Running the example

Run the PHP script as follows

$ ./listVS.php
Main website
Mail servers
Test site
Owen Garrett [Zeus Dev Team] 20 October 2005  Permalink  
Leave a comment ...
Your email address will not be displayed.
Your URL will be displayed.
This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.
Options:
 
(Line breaks become <br />)
(Set cookies for name, email & url)
Download Free ZXTM Desktop Edition

Recent Articles

Other Resources



www.zeus.com