load('http://weather/weather/all-output.xml'); $arrFeeds = array(); foreach ($doc->getElementsByTagName('weather') as $node) { $itemRSS = array ( $item => $node->getElementsByTagName($item)->item(0)->nodeValue, ); array_push($arrFeeds, $itemRSS); } echo $itemRSS[$item]; } function summon($person,$status) { $myFile = "summon.txt"; $list = file("summon.txt"); $fh = fopen($myFile, 'w') or die("can't open file"); $matched=0; foreach ($list as $summoned) { list($item,$flag) = split("=",trim($summoned)); if ($person == $item) { fwrite($fh, "$person=$status\n"); $matched=1; } else { if (strlen($item) > 0) { fwrite($fh, "$item=$flag\n"); } } } fclose($fh); if ($matched==0) { $fh = fopen($myFile, 'a') or die("can't open file"); fwrite($fh, "$person=$status\n"); fclose($fh); } } function summon_status($person) { $myFile = "summon.txt"; $list = file("summon.txt"); foreach ($list as $summoned) { list($item,$flag) = split("=",$summoned); if ($person == $item) { return($flag); } } return($status); } ?>