Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#827476
Hi all! I am trying to export all the data collected throughout the whole process that I made, meaning this is the last step before ending it. So what happens is that no matter where in the task do I place the trigger that generates the CSV, the process always ends up freezing and not letting me press the finish button so I can be relocated to the main cases page.

If debugger mode is activated, whenever I reach the point of picture #1, pressing the finish button creates and downloads the CSV but then makes the case to stop working, leaving me stuck in that screen (I can still click the right menu and exit the process that way, but ofc this is not intended behaviour).
If debbuger mode is deactivated, the same thing happens, this time, since there is no finish button the loading gif starts spinning forever.
Screenshot from 2020-01-28 14-39-19.png
Screenshot from 2020-01-28 14-39-19.png (33.09 KiB) Viewed 2819 times
Using Xampp I had no issues on the matter. The CSV is always created both in PM and via Xampp. I just need to know why is the PM case freezing like that. I am using dummy values at the moment because I wanted to try and see if there was any issue, but this should create a CSV with my hardcoded data even so.
Here is the Trigger:
Code: Select all
function arrayToCsv($array, $filename, $delimiter = ';'){
	
    header('Content-Type: application/csv');

    
    header('Content-Disposition: attachment; filename="'.$filename.'";');

	$f = fopen('php://output', 'w');

	foreach ($array as $line) {
		fputcsv($f, $line, $delimiter);
	}
} 


$array = array(
	array("test", "username", "email", "extension"),
	array("test2", "username2", "email2", "extension2"),
	array("test3", "username3", "email3", "extension3"),
	array("test4", "username4", "email4", "extension4")
); 

//pasar el nombre de la empresa en minuscula + .csv
$filename = "Test Test TEst";
$filename = strtolower(str_replace(' ', '', $filename)); 
$filename = $filename.".csv";

arrayToCsv($array, $filename);

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]