I have created a file download system with php. I created like that
phpfiledownload.php
--------------------
<?php
$file = 'testing.php';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
} ?>
And I also created testing.php
file like the following
testing.php
------------
<?php echo "Hello World"; ?>
When I run phpfiledownload.php
form my localhost I got testing.php
file.
But when I change testing.php
to http://www.anotherdomain.com/example.php
in phpfiledownload.php
I can't download http://www.anotherdomain.com/example.php
.
So, how I can got http://www.anotherdomain.com/example.php
via my phpfiledownload.php