$to_module_name = $_REQUEST["to_module_name"]; $array = array($chat->open_session($from_module_name, $from_module_id, $to_module_name, $to_module_id)); // This is one of the few times that the output is not a double nested array, So I have to make it one //print_r( $array ); break; case "send_message": $session_id = $_REQUEST["session_id"]; $module_id = $_REQUEST["module_id"]; $module_name = $_REQUEST["module_name"]; $message = $_REQUEST["message"]; $chat->send_message($session_id, $module_name, $module_id, $message); $array = array(array('Message Worked' => "Yaa!")); break; case "close_window": $session_id = $_REQUEST["session_id"]; $module_id = $_REQUEST["module_id"]; $module_name = $_REQUEST["module_name"]; $chat->close_window($session_id, $module_id, $module_name); $array = array(array('Message Worked' => "Yaa!")); break; } switch ($format) { case "yui": case "YUI": default: echo $yui->array_to_yuixml($array); break; case "xml": echo $yui->array_to_xml($array); break; }