Results 1 to 11 of 11

Thread: wget php

  1. #1
    Join Date
    Apr 2005
    Posts
    697

    wget php

    PHP Code:
    exec("/usr/bin/wget"$temp2 ." > /dev/null 2>&1 &"); 
    That doesn't seem to work, I'm trying to run wget in a php script...

  2. #2
    Maybe you don't have permissions to run wget as Apache, maybe you need to be another user to run it.

  3. #3
    Join Date
    Apr 2005
    Posts
    697
    do you know how i can download a file with php?

  4. #4
    I remember you can read files, also if they are on another website with fread and file functions, you can read the file, and after you can write it on your space.

    Of course you could need the necessary memory allowed.

  5. #5
    Join Date
    Apr 2005
    Posts
    697
    right, but how about simply download them like wget?

  6. #6
    To run wget, you need to have permissions, now I'm not sure about users that can run wget, however, for example if you are root, you can run php and wget, if the space is on your server, you could set a php script that check a database, and if there is a file to download, it calls wget, and this script could be runned as Root by CronJob, every X minutes.

  7. #7
    Join Date
    May 2004
    Posts
    354
    have you tried using an alternative like curl -o?

  8. #8
    Or maybe you just need a space. I guess it depends on the value of $temp2.
    PHP Code:
    exec("/usr/bin/wget "$temp2 ." > /dev/null 2>&1 &"); 

  9. #9
    To do it with just PHP, use something like:

    PHP Code:
    <?
    file_put_contents
    ('filename'file_get_contents('url'));
    ?>
    (Replacing "filename" with the local filename to save to, and "url" with the url, of course)

  10. #10
    Join Date
    Mar 2006
    Posts
    421
    you can use curl as well if the above doesnt work

  11. #11
    Join Date
    Apr 2005
    Posts
    697
    Thanks all!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •