Jump to content

Sockets and remote downloading


marklarah

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.