PHP generate and download file

Hey people,

I have a system in PHP and I use kodular to open it like an APP. I have a problem to export data from mysql database. I use the code below to generate and download file but when I click in the button to generate using que APP nothing happen. Only works in browser

<? header("Content-type: text/csv"); header("Cache-Control: no-store, no-cache"); header('Content-Disposition: attachment; filename='.$nome_arquivo_csv); $fp = fopen('php://output', 'w'); fputcsv($fp, $corridas, ";"); ?>