false); while (!feof($fsock) && !$info['timed_out']) { $buffer .= fread($fsock, 1024); $info = stream_get_meta_data($fsock); } fclose($fsock); if ($info['timed_out'] || !$buffer) { return null; } if (substr($buffer, 9, 3) != "200") { return null; } $result = explode("\r\n\r\n", $buffer, 2); if (count($result) < 2) { return null; } return $result[1]; } /** * Load config xml-file * * @param string $fileName * @return \SimpleXMLElement */ public static function loadConfig($fileName) { if (!$fileName) { return null; } $fileLocation = ManiaControlDir . '/configs/' . $fileName; if (!file_exists($fileLocation)) { trigger_error("Config file doesn't exist! ({$fileName})"); return null; } return simplexml_load_file($fileLocation); } } ?>