Herhangi bir sayfadan dosyaları Forcedownload!

0 Cevap php

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.

Ancak bu senaryo elbette her sayfa için çalışmıyor. Ben bunu yapmak için izniniz yok çoğu zaman!

HTTP isteği başarısız oldu! HTTP/1.0 403 .... Yasak

Is there a method where i can check if the forcedownload from some domain would work or not. Like is_readable() or something.

Saygılarımızla mat

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);
    ?>

0 Cevap