$file = "mdMetrics.xml" ;
$handle = fopen($file, "r") ;
$i = 1 ;
$mdIB = array() ;
$IB = array() ;
while(!feof($handle)) {
$l = fgets($handle) ; ;
if(strstr($l,"MDIB")) { //Gets us to the MD IB Team section.
$garbage_line = fgets($handle) ; //Catches .
while(!feof($handle)) {
$garbage_line = fgets($handle) ; //Catches .
if(strstr($garbage_line, "")) { //Kills process, end of reps.
break ;
}
$l3 = fgets($handle) ; //Grabs first line of cycle.
while(!strstr($l3, "")) { //Catches end of a specific rep's stats.
$l3 = ltrim(rtrim($l3)) ; //String manipulation to extract category for array key.
$l3 = substr(str_replace(array("<", ">"), ",", $l3), 1) ;
$l3 = explode(",", $l3) ;
$mdIB[$i][$l3[0]] = $l3[1] ;
$l3 = fgets($handle) ;
}
$i++ ;
}
}
}
//Reorganize the array to reflect [REP][STAT]
foreach($mdIB as $v) {
foreach($v as $k => $n) {
if($k == "EXTERNALUSERID") {
$IB[$n] = array() ;
reset($v) ;
foreach($v as $ki => $nm) {
$IB[$n][$ki] = $nm ;
}
}
}
}