function startElement($parser, $tagName, $attrs) {
global $insideitem, $tag, $ac2_server, $ac2_datac, $ac2_population;
if ($insideitem) {
$tag = $tagName;
} elseif ($tagName == "SERVER")
{
$insideitem = true;
while (list ($key, $val) = each ($attrs)) {
switch($key) {
case "NAME": $ac2_server=$val;break;
case "DATACENTER" : $ac2_datac=$val;break;
} // end case
} // end while
}
}
function characterData($parser, $data) {
global $insideitem, $tag, $ac2_server, $ac2_population, $ac2_limit, $ac2_totalpop;
if ($insideitem) {
switch ($tag) {
case "CURRENT": $ac2_population .= $data;
$ac2_totalpop += $data; break;
case "LIMIT": $ac2_limit .= $data; break;
}
}
}
function endElement($parser, $tagName) {
global $insideitem, $tag, $ac2_server, $ac2_datac, $ac2_population, $ac2_limit;
if ($tagName == "SERVER") {
print "<TR><TD><b>$ac2_server</b>";
print "<TD>$ac2_datac</td>";
print "</TD>";
print "<TD>$ac2_population</TD>";
print "<TD>$ac2_limit</TD></TR>\n";
// Open the XML file for reading
$fp = fopen("http://localhost/xmlstat.xml","r") or die("Error reading RSS data.");
// Read the XML file 4KB at a time
while ($data = fread($fp, 4096))
// Parse each 4KB chunk with the XML parser created above
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
// Close the XML filef
fclose($fp);
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum