davidjmorin Posted March 8, 2012 Share Posted March 8, 2012 I have the following <?php $url = 'http://www.google.com'; $outputfile = "dl.html"; $cmd = "wget -r -l1 -H -t1 -nd -N -np -erobots=off -i \"$url\" -O $outputfile"; exec($cmd); echo file_get_contents($outputfile); ?> This does not write to the DL file Any help ? Quote Link to comment https://forums.phpfreaks.com/topic/258524-wget-and-php-help/ Share on other sites More sharing options...
QuickOldCar Posted March 8, 2012 Share Posted March 8, 2012 Maybe this would help you. <?php $file = 'dl.html'; // open the url and get content $url = file_get_contents('http://www.google.com'); //write the contents to the file file_put_contents($file, $url); //display the url contents //echo $url; //Display contents from the file include($file); ?> Quote Link to comment https://forums.phpfreaks.com/topic/258524-wget-and-php-help/#findComment-1325195 Share on other sites More sharing options...
davidjmorin Posted March 8, 2012 Author Share Posted March 8, 2012 what im really looking to do is grab images and put into images dir I have a site with over 10k images that i would like to grab and move... I know i can just move it easily but i wanna try to do it with coding Quote Link to comment https://forums.phpfreaks.com/topic/258524-wget-and-php-help/#findComment-1325197 Share on other sites More sharing options...
QuickOldCar Posted March 8, 2012 Share Posted March 8, 2012 I guess can do this way. Use glob() and find the image type files. Then file_put_contents() the location you want. Could even do a check if file_exists() new image, then unlink() the original image. That's providing you don't need it somewhere. Quote Link to comment https://forums.phpfreaks.com/topic/258524-wget-and-php-help/#findComment-1325203 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.