'; $result = ""; $resultDoc = ""; $fp = @fsockopen($host, $port, &$errno, &$errstr, 2); if(!$fp) { echo "Failed to excute api command,maybe host chat server is not started"; } else { fputs($fp,$apiCommand."\0"); while (!feof($fp)) { $resultDoc .= fgets($fp, 1024); $resultDoc = rtrim($resultDoc); } $parser = xml_parser_create("UTF-8"); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); if (!xml_parse_into_struct($parser, $resultDoc, $values, $tags)) { printf("XML error: %s at line %d while parsing entity n", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser)); echo "xml parse error"; } else { print_r($values); xml_parser_free($parser); fclose($fp); } } } header("Location: vidchat.php"); exit; ?>