marklarah Posted April 15, 2009 Author Share Posted April 15, 2009 <? exec("wget target_url http://thesite.com/files/brochure1.zip"); ?> I can't seem to get it to work :| Quote Link to comment Share on other sites More sharing options...
laffin Posted April 15, 2009 Share Posted April 15, 2009 options are preceded by '--' or on windows '-'. there shudda been a help document that comes with it or u can search google again to see how to use wget Quote Link to comment Share on other sites More sharing options...
marklarah Posted April 15, 2009 Author Share Posted April 15, 2009 It's on a linux server... laffin, I've already said, I've scoured the deepest corners of google, and I an tell you, I can't find anything that will help me with what I want to achieve. Quote Link to comment Share on other sites More sharing options...
marklarah Posted April 15, 2009 Author Share Posted April 15, 2009 Guys please help me I've tried looking at google at php.net, I just really need some code now, on how to this with sockets or wget Quote Link to comment Share on other sites More sharing options...
marklarah Posted April 15, 2009 Author Share Posted April 15, 2009 bump Quote Link to comment Share on other sites More sharing options...
Axeia Posted April 15, 2009 Share Posted April 15, 2009 exec("wget target_url http://thesite.com/files/brochure1.zip"); Should work IF PHP (think the user is 'apache2') has permission to use WGET and if PHP has write rights on the output folder. Try <?php $arr = array(); exec("wget target_url http://thesite.com/files/brochure1.zip", $arr ); print_r( $arr ); ?> To see what's what's going wrong. Quote Link to comment Share on other sites More sharing options...
Carth Posted April 15, 2009 Share Posted April 15, 2009 Uhm target_url was an example, did you even read the man page that gizmola posted. Replace target_url with the actual URL, don't leave it in the command. wget http://thesite.com/files/brochure1.zip And if you'd done half as much Googling as you claim, and less bumping, you'd know that. Quote Link to comment Share on other sites More sharing options...
Carth Posted April 15, 2009 Share Posted April 15, 2009 After looking at the problem, I don't actually see the point of calling wget in a PHP script. It will halt execution while waiting for it to return, which means you still time out after 30 seconds. If you prevent it from halting execution, then you don't know when the download has finished. If your script waits for it to finish then you are going to time out again. So you need a second script to get at the file that you used wget on. I believe the original suggestion - the very first reply - was to use wget yourself in a shell, not to use wget in PHP. Then use FTP or scp, and no need to write a script when these tools do exactly that already. But I don't understand the point of this. It sounds like a proxy server. Quote Link to comment 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.