xpath('//VHost/Application/ApplicationInstance/Stream[Name="'.$endpoint.'"]'); //print_r($streams); foreach($streams as $key => $value) { foreach($value as $key2 => $value2) { if ($key2 == 'SessionsTotal') { $totalListeners = $totalListeners + $value2; } } } if ($totalListeners > $line) { $line = $totalListeners; $handle = fopen("c:\inetpub\wwwroot\shoutcast-ukcr\peak.txt", "w"); fwrite($handle, $line); fclose ($handle); } echo ''.$totalListeners.',1,'.$line.',1000,'.$totalListeners.',64,No title'; ?>