Skip to content

Instantly share code, notes, and snippets.

@benphelps
Forked from gig3m/geektool-vent.php
Created August 26, 2011 20:53
Show Gist options
  • Save benphelps/1174416 to your computer and use it in GitHub Desktop.
Save benphelps/1174416 to your computer and use it in GitHub Desktop.
<?php
$url = "http://ventrilostatus.net/xml/nitrogen.typefrag.com:11101/";
//$xml = file_get_contents($url);
$xml = file_get_contents("source.xml");
$base = simplexml_load_string($xml);
$bold_pre = "\033[1;1m";
$bold_post = "\033[0m";
//print_r($base);
function printChild($array, $depth = 0) {
foreach($array->children() as $child) {
if ($child->getName() == "channel") {
print(str_repeat(" ", $depth)."Channel: ".$child['name']." \n");
}
elseif ($child->getName() == "client") {
print(str_repeat(" ", $depth)."Client: ".$child['name']." \n");
}
printChild($child, $depth+1);
}
}
printChild($base);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment