I need to download an apk application but I need to keep the user in my page or redirect him to another page with header I can only download the application or redirect him to another page, but I can't do both at the same time my php code :
$b= "location";
echo "<script>window.location.href = '$b';</script>" ;
$file = 'apk.apk';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
}