Results 1 to 11 of 11
Thread: wget php
-
09-27-2006, 01:39 PM #1Web Hosting Master
- Join Date
- Apr 2005
- Posts
- 697
wget php
PHP Code:exec("/usr/bin/wget". $temp2 ." > /dev/null 2>&1 &");
-
09-27-2006, 02:24 PM #2Newbie
- Join Date
- Jun 2006
- Posts
- 13
Maybe you don't have permissions to run wget as Apache, maybe you need to be another user to run it.
-
09-27-2006, 02:26 PM #3Web Hosting Master
- Join Date
- Apr 2005
- Posts
- 697
do you know how i can download a file with php?
-
09-27-2006, 02:35 PM #4Newbie
- Join Date
- Jun 2006
- Posts
- 13
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.
-
09-27-2006, 02:37 PM #5Web Hosting Master
- Join Date
- Apr 2005
- Posts
- 697
right, but how about simply download them like wget?
-
09-27-2006, 02:50 PM #6Newbie
- Join Date
- Jun 2006
- Posts
- 13
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.
-
09-27-2006, 03:38 PM #7Aspiring Evangelist
- Join Date
- May 2004
- Posts
- 354
have you tried using an alternative like curl -o?
-
09-27-2006, 04:11 PM #8Newbie
- Join Date
- Dec 2005
- Posts
- 26
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 &");
-
09-27-2006, 04:29 PM #9New Member
- Join Date
- Sep 2006
- Posts
- 1
To do it with just PHP, use something like:
PHP Code:<?
file_put_contents('filename', file_get_contents('url'));
?>
-
09-27-2006, 05:11 PM #10Aspiring Evangelist
- Join Date
- Mar 2006
- Posts
- 421
you can use curl as well if the above doesnt work
-
09-28-2006, 06:24 PM #11Web Hosting Master
- Join Date
- Apr 2005
- Posts
- 697
Thanks all!