#!/usr/bin/php -q $value) { if (is_object($value) || is_array($value)) { $value = objectsIntoArray($value, $arrSkipIndices); // recursive call } if (in_array($index, $arrSkipIndices)) { continue; } $arrData[$index] = $value; } } return $arrData; } function getServerXmlInfo($ip, $username, $password) { $url = "http://".$ip.":8086/connectioncounts/"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 0); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); curl_setopt($ch, CURLOPT_URL, $url); $xml = curl_exec($ch); curl_close ($ch); $xmlObj = simplexml_load_string($xml); $xmlArr = objectsIntoArray($xmlObj); $array = $xmlArr["VHost"]["Application"]; $total = $xmlArr["ConnectionsCurrent"]; if (is_array($array)) { foreach ($array as $index => $value) { if (count($array[$index]) > 1) { $name = $array[$index]["Name"]; $results[$name] = $array[$index]["ConnectionsCurrent"]; } } } $results["total"] = $total; return $results; } $ip = $_SERVER['argv']["1"]; $username = "wowzastats"; $password = "wowzastatspassword"; $infoArr = getServerXmlInfo($ip,$username,$password); // print_r($infoArr); $sonuc = $infoArr["total"]; echo $sonuc; ?>