Apache Status in XML using PHP
Login or Register to Bookmark this snippet
This scripts displays Apache 2.0.x server status information and formats the data into an XML document.
<?php
// phpExamples.net (http://phpexamples.net)
// Author: Rob Burris ( robeb@phpexamples.net
//
// This scripts displays Apache 2.0.x server
// status information and formats the data into
// an XML document.
// Machine readable server status URL.
$url = "http://localhost/server-status?auto";
// Use the metadata as the key and the data as the element (i.e. BusyWorkers => 2).
foreach($dataArray as $k => $v) {
$outputArray[$infoArray[0]] = $infoArray[1];
};
// Format the data into a nice XML document where the keys become elements.
echo "<?xml version="1.0" encoding="ISO
-8859-1" ?>n";
foreach($outputArray as $k => $v) {
// We don't want Scoreboard because it skews the XML document.
if ($k == "Scoreboard") {
echo "</apacheStatus>\n";
}
echo " <".
$k.
">".
$v.
"</".
$k.
">\n";
};
echo "</apacheStatus>\n";
?>
Added by JC on 11th November, 2007
There are no comments about this snippet.
You must be registered and logged in to post a comment.
Login here to post a comment