hey guys, i wanna download any file from any website with my forcedownload script. simple script which just prompts a download window to save the file to the desktop. I simply pass ?path=http://www.google.com/images/whatever/file.jpg to the url and the script fires the download.
However this script is of course not working for every page. Most of the time I don't have the permissions to do so!
HTTP request failed! HTTP/1.0 403 Forbidden in ....
Is there a method where i can check if the forcedownload from some domain would work or not. Like is_readable() or something.
regards matt
edit:
<?php
error_reporting(E_ALL);
if(isset($_GET['p'])) $path = $_GET['p'];
else header('Location:' . 'mypage');
$file = $path;
//header('Location:' . $file);
//
header("Cache-Control: no-cache");
header("Expires: -1");
header("Content-Type: application/octet-stream;");
header("Content-Disposition: attachment; filename=\"" . basename($file) . "\";");
header("Content-Transfer-Encoding: binary");
//header("Content-Length: " . filesize($file));
//echo file_get_contents($file);
echo readfile($file);
?>