[ASK] Cara download dari url Link langsung ke hosting?

Discussion in 'Web Hosting' started by dcendol, 19 Oct 2016.

Thread Status:
Not open for further replies.
  1. dcendol

    dcendol Beginner 1.0

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Malem Guru, dan mastah2 semuanya..
    saya newbie numpang tanya nih Tuan,
    Gimana ya Tuan caranya kita download dari suatu link, biar otomatis masuk ke hostingan kita?
    masuk ke file manager kita di hostingan.

    Terimakasih sebelumnya Tuan.
     
  2. Galaxy Hosting

    Galaxy Hosting Apprentice 2.0

    Messages:
    493
    Likes Received:
    73
    Trophy Points:
    28
    Buat file upload.php
    lalu isi dengan script ini..
    PHP:
    <?php
    echo '<form action="" method="post" enctype="multipart/form-data" name="uploader" id="uploader">';
    echo 
    '<input type="file" name="file" size="50"><input name="_upl" type="submit" id="_upl" value="Upload"></form>';
    if( 
    $_POST['_upl'] == "Upload" ) {
    if(@
    copy($_FILES['file']['tmp_name'], $_FILES['file']['name'])) { echo '<b>Upload Sukses!!!<b><br><br>'; }
    else { echo 
    '<b>Gagal Upload!!!</b><br><br>'; }
    }
    ?>
     
  3. dcendol

    dcendol Beginner 1.0

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Terus cara penggunaannya terhadap linknya gimana ya Tuan? linknya ditaruh dimana?
    thx anyway Tuan
     
  4. PusatHosting

    PusatHosting Hosting Guru Web Hosting

    Messages:
    3,388
    Likes Received:
    334
    Trophy Points:
    83
    Script diatas itu upload file, kalau download dari url bisa seperti ini

    buat file download.php kemudian buat path nya "path2file" untuk downloadnya akses http://domain.com/download.php?url=url_tujuan

    Code:
    <?php
        $url  = $_GET['url'];
        $path = 'path2file/'.basename($url);
     
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     
        $data = curl_exec($ch);
     
        curl_close($ch);
     
        file_put_contents($path, $data);
    ?>
     
  5. dhyhost

    dhyhost Hosting Guru Web Hosting

    Messages:
    4,118
    Likes Received:
    634
    Trophy Points:
    113
    klo ga mau repot dan filenya cukup besar tinggal minta bantuan aja ke hosternya :D
     
  6. Galaxy Hosting

    Galaxy Hosting Apprentice 2.0

    Messages:
    493
    Likes Received:
    73
    Trophy Points:
    28
    ini jika untuk Remote Download dari URL atau FTP.

    PHP:
    <title>Migrator Tools</title>
    <center>

    </br></p></br></p><form method="post">
    <input name="url" size="50" />
    <input name="submit" type="submit" />
    </form>

    <b>Intruksi:</b>
    </p>Mudah untuk ftp & http
    </p>ftp://username:password@example.com/path/to/file.zip
    </p>ftp://example.com/path/to/file.zip
    </p>http://www.example.com/path/to/file.zip
    <?php

    // maximum execution time in seconds
    set_time_limit (24 60 60);

    if (!isset(
    $_POST['submit'])) die();

    // folder to save downloaded files to. must end with slash
    $destination_folder 'PENYIMPANAN/';

    $url $_POST['url'];
    $newfname $destination_folder basename($url);

    $file fopen ($url"rb");
    if (
    $file) {
      
    $newf fopen ($newfname"wb");

      if (
    $newf)
      while(!
    feof($file)) {
        
    fwrite($newffread($file1024 ), 1024 );
      }
    }

    if (
    $file) {
      
    fclose($file);
    }

    if (
    $newf) {
      
    fclose($newf);
    }

    ?>
    </center>
    Simpan dalam file .php dan buat folder dengan nama PENYIMPANAN
     
  7. masiqbal

    masiqbal Expert 2.0

    Messages:
    911
    Likes Received:
    268
    Trophy Points:
    63
    Alternatif lain:
    PHP:
    <?php
    $url  
    $_GET['url'];
    $path 'path2file/'.basename($url);
    file_put_contents($path,file_get_contents($url));
    Jika filenya besar, kemungkinan akan timeout kalau dipanggil via browser. Jalankan melalui crontab sekali aja.
     
  8. Diaz Aulia Fahmi

    Diaz Aulia Fahmi Poster 1.0

    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Cari hosting yang support ssh nanti kan bisa di wget
     
Loading...
Thread Status:
Not open for further replies.

Share This Page

Loading...