";
print "Raw XML Returned:
";
print "
";
if($FontSize){
print "";
}
$xml_esc=str_replace("<","<",$xml);
print $xml_esc;
if($FontSize){
print "";
}
print "";
print "
Contents of PHP array of the Parsed XML:
";
$Results=xml2array($xml);
print_r($Results);
//print "
HTML Output based on the PHP array of the Parsed XML:
";
//foreach($Results[EventAdd] as $Line){
//print_r($Line);
//print "click to view new event E$Line[AssignedEventNumber] in a new window";
//}
}else{
print "";
}
exit();
function http_get($URL){
$URL=str_replace("\"","%34",$URL);
$URL=str_replace("\n","",$URL);
return `/usr/bin/lynx -source "$URL"`;
}
function xml2array( $textXml ){
$regExElements = '/<(\w+)([^>]*)>(.*?)<\/\\1>/s';
$regExAttributes = '/(\w+)="([^"]*)"/';
preg_match_all( $regExElements, $textXml, $matchElements );
foreach ( $matchElements[1] as $keyElements=>$valElements ) {
if ( $matchElements[2][$keyElements] ) {
preg_match_all( $regExAttributes, $matchElements[2][$keyElements], $matchAttributes );
foreach ( $matchAttributes[0] as $keyAttributes=>$valAttributes ){
$arrayAttributes[ $valElements.' attributes' ][$matchAttributes[1][ $keyAttributes ] ] = $matchAttributes[2][ $keyAttributes ];
}
}else{
$arrayAttributes = null;
}
if ( preg_match( $regExElements, $matchElements[3][$keyElements]) ) {
if ( $arrayAttributes ){
$arrayFinal[ $valElements ][ $valElements.' attributes' ] = $arrayAttributes[ $valElements.' attributes' ];
}
$arrayFinal[ $valElements ][] = xml2array( $matchElements[3][$keyElements] );
}else{
$arrayFinal[ $valElements ] = $matchElements[3][ $keyElements ];
$arrayFinal = array_merge( $arrayFinal, $arrayAttributes );
}
}
return $arrayFinal;
}
?>