i require a script which downloads file from other server to my server..

Discussion in 'PHP' started by remember123, Oct 3, 2008.

  1. #1
    i require a script which downloads file from other server to my server..
    pls !:D
     
    remember123, Oct 3, 2008 IP
  2. keyaa

    keyaa Peon

    Messages:
    137
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This is one of many ways to do it, everything in one line of code:
    fwrite(fopen($local_filename, 'wb'), file_get_contents($remote_url));
    PHP:
     
    keyaa, Oct 3, 2008 IP
  3. chandan123

    chandan123 Prominent Member

    Messages:
    11,586
    Likes Received:
    578
    Best Answers:
    0
    Trophy Points:
    360
    #3
    will it handle 100 MB files too :eek:
     
    chandan123, Oct 3, 2008 IP
  4. remember123

    remember123 Peon

    Messages:
    620
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    actually i want to handle 700 mb files! ..pls can u provide it to me with a gui!
     
    remember123, Oct 3, 2008 IP
  5. keyaa

    keyaa Peon

    Messages:
    137
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It wouldn't be able to handle very large files because the data is internally temporarily stored as a string, in memory. So it depends on your php.ini settings, or you can overwrite them with ini_set:
    ini_set(”memory_limit”,”700M”)
    PHP:
    but, this is not recommended! :rolleyes:
    Sorry, I don't have a GUI for this. You could try this one:
    http://www.hotscripts.com/Detailed/64402.html
     
    keyaa, Oct 3, 2008 IP
    chandan123 likes this.
  6. chandan123

    chandan123 Prominent Member

    Messages:
    11,586
    Likes Received:
    578
    Best Answers:
    0
    Trophy Points:
    360
    #6
    ok thanks for that +rep added :)

    so its better do ftp in ssh :D
     
    chandan123, Oct 3, 2008 IP
  7. Sillysoft

    Sillysoft Active Member

    Messages:
    177
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Sillysoft, Oct 3, 2008 IP
  8. proxywhereabouts

    proxywhereabouts Notable Member

    Messages:
    4,027
    Likes Received:
    110
    Best Answers:
    0
    Trophy Points:
    200
    #8
    Try buying transloader from scripteen.com. I use it for transferring large files server to server.
     
    proxywhereabouts, Oct 3, 2008 IP
  9. ghprod

    ghprod Active Member

    Messages:
    1,010
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    78
    #9
    why dont use rapidleech :)

    @keyaa

    btw file_get_contents just return in string right?

    really can download into our server?

    i'm sorry .. i'm newbie :)
     
    ghprod, Oct 3, 2008 IP
  10. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
  11. techcone

    techcone Banned

    Messages:
    206
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #11
    fsockopen , copy() and fwrite() , I use all of them in my script with no problem.

    copy() works great for me in my site of rapidshare premium link generator.

    It handeles any amount of data too . :)
     
    techcone, Oct 4, 2008 IP
  12. ghprod

    ghprod Active Member

    Messages:
    1,010
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    78
    #12
    Yes .. i see in rapidleech script use fsockopen .. can u give a simple code about that?

    Thnx
     
    ghprod, Oct 4, 2008 IP
  13. techcone

    techcone Banned

    Messages:
    206
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #13
    <?php
    $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
    if (!$fp) {
        echo "$errstr ($errno)<br />\n";
    } else {
        $out = "GET / HTTP/1.1\r\n";
        $out .= "Host: www.example.com\r\n";
        $out .= "Connection: Close\r\n\r\n";
    
        fwrite($fp, $out);
        while (!feof($fp)) {
            echo fgets($fp, 128);
        }
        fclose($fp);
    }
    ?>
    
    PHP:
     
    techcone, Oct 4, 2008 IP
    remember123 and chandan123 like this.
  14. remember123

    remember123 Peon

    Messages:
    620
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #14
    thanks!! will be using this!
     
    remember123, Oct 4, 2008 IP
  15. chandan123

    chandan123 Prominent Member

    Messages:
    11,586
    Likes Received:
    578
    Best Answers:
    0
    Trophy Points:
    360
    #15
    techcone thanks :) +rep added

    what if the host rejects the get command ?? :eek:
     
    chandan123, Oct 4, 2008 IP
  16. techcone

    techcone Banned

    Messages:
    206
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Depends on whether the site uses GET or POST.

    Server does not reject it unless it is not accepting it on the whole ! :)
     
    techcone, Oct 4, 2008 IP
  17. ghprod

    ghprod Active Member

    Messages:
    1,010
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    78
    #17
    Thnx for this one Man :)
     
    ghprod, Oct 5, 2008 IP
  18. sojic

    sojic Active Member

    Messages:
    133
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    90
    #18
    As administrator, I have full access to servers, so I will do it with linux command wget. For example

    <?
    shell_exec("wget "+$url);
    ?>
     
    sojic, Oct 5, 2008 IP