0

i have must change (hide) a download url.

File to download: http://servdown.com/f1.rar User is on page: http://mypage.com/down.php?id=1

But i don't need a redericting to domain with file ( servdown.com/f1.rar ).

Please help, i find how to hide the actual download folder location ,but that's bad.

Sorry for my bad English, thank

Community
  • 1
  • 1
Mubby
  • 95
  • 1
  • 12

2 Answers2

0

You need to use some proxy type script which downloads the file remotely and then output the downloaded data ... There are many answers here , you just need to search you can get the exact code from there .

Here is one link : How to Hide link

Hope it helps ...

Community
  • 1
  • 1
Jeff Harry
  • 26
  • 3
0
<?php
// Enter ur url:
$file = 'https://test.com/test.zip';
//get the file headers
$headers = get_headers ($file);
$Content_Type = '';
$Content_Length = '';
for ($i = 0; $i < count($headers); $i++) {
    $header = explode(":", $headers[$i]);
    //find content type in headers
    if ($header[0] == 'Content-Type') {
        $Content_Type = $headers[$i];
    }
    //find content length in headers
    if ($header[0] == 'Content-Length') {
        $Content_Length = trim($header[1]);
    }
}
// export name file from url
$filenameexploded = explode('/', $file);
$filenameexploded2 = explode('?', $filenameexploded[count($filenameexploded)-1]);
$filename = $filenameexploded2[0];
// send headrs
header($Content_Type);
header('Content-Length: ' . $Content_Length);
header('Content-Disposition: attachment; filename=' . $filename);
// read file
readfile($file);
EErfan
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 29 '22 at 19:58