header('Content-Transfer-Encoding: binary'); if ($edit) { header(sprintf("Content-Disposition: attachment; filename=\"asr_%s_corrected.%s\"", $id, $type)); } else { header(sprintf("Content-Disposition: attachment; filename=\"asr_%s.%s\"", $id, $type)); } } switch ($type) { case "vtt": header("Content-Type: text/vtt"); echo $video->convert_json_to_VTT($data); break; case "sbv": header("Content-Type: text/sbv"); echo $video->convert_json_to_SBV($data); break; case "txt": header("Content-Type: text/plain"); echo $video->convert_json_to_txt($data); break; case "srt": header("Content-Type: text/srt"); echo $video->convert_json_to_srt($data); break; case "json": header("Content-Type: application/json"); echo json_encode($data); break; default: return False; }