By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,303 Members | 1,260 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,303 IT Pros & Developers. It's quick & easy.

Download and Extract zip file

P: 16
HI,
Is there a php function that can be used to download a zip file from a different server and then extract it to a specific location on my server?
I want to run this file in cron so it works automatically.

Thanks
Aug 29 '08 #1
Share this Question
Share on Google+
3 Replies


P: 16
OK I found the answer my self.
Here is the code to download a file:

[PHP]<?php
$foo = system('wget http://www.domain.com/file.zip',$output);
?>[/PHP]
Aug 29 '08 #2

P: 16
And to extract (unzip) the file use the following code:


[PHP]<?php
exec('unzip file.zip');
?>[/PHP]
Aug 29 '08 #3

Atli
Expert 5K+
P: 5,058
Hi.

Those would be limited only to some Linux distributions.

For a more reliable method, you may want to check out PHP's Zip extension.
Aug 30 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.