function f5_active_server($lbs, $username, $password) { global $location_suffix, $wsdl_service_failover_suffix; foreach ($lbs as $index => $lb) { $location = "https://{$lb}" . $GLOBALS['location_suffix']; $wsdl_service_failover = "https://{$lb}" . $GLOBALS['wsdl_service_failover_suffix']; $client = new SoapClient($wsdl_service_failover, array('location' => $location, 'login' => $username, 'password' => $password)); $result = $client->get_failover_state(); if ($result == "FAILOVER_STATE_ACTIVE") { return $lb; } } return false; }