I ZIP all my reports into a single ZIP file. When I turn off IDM, the download process tooks 20 seconds. But when enable IDM, it tooks 20 seconds to show the IDM download dialog, then after I click OK, it tooks another 20 seconds.
Can I do something bout this at my PHP code so that IDM user wont suffer? Or any explanation?
This is how I create Zip file in PHP:
$zip = new ZipArchive();
$filename = "Test.zip";
if($zip->open($filename, ZipArchive::CREATE)!==TRUE) die("cannot open <$filename>\n");
foreach([1,2,3,4,5] as $id) {
$path = dirname($_SERVER['HTTP_REFERER']) . '/myreport.php';
$ch = curl_init($path);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['id' => $id]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
$get_file = curl_exec($ch);
curl_close($ch);
if($get_file === false) echo 'CURL ERROR: '.curl_error($ch);
$zip->addFromString("Report $id.pdf", $get_file);
}
$zip->close();
header('Content-disposition: attachment; filename='.$filename);
header('Content-type: application/zip');
ob_clean();
readfile($filename);
unlink($filename);
die;