I was wondering if it is possible to download/copy a zipped file with images from one server to another and then unzip the file to a folder with PHP? If so, any suggestions of how or where to read up on it?

By the way, the zip file requires a password to be unzipped.


9 Years
Discussion Span
Last Post by sDJh

what you could do is to open a connection to the other server with socket_connect() (http://de2.php.net/manual/en/function.socket-connect.php). You write a HTTP-Request, save the binaries on your server and unzip it with the zip-lib (have a look at PHP.net). It should also support password protected files.

But you better try it out before you do all the fuss because, as far as I know, most servers deny the php-scriptengine to open a connection to another server.


Thanks sDJh. The link for the image zip file is actually an FTP link. Would there still be an issue connecting to the other server? Would I need to check with the host in which the connection is coming from if it is allowed?



FTP is a bit more complicated than HTTP. It can be a bit frustating when doing it the first time, but as I did it (not in PHP), I think it's manageble =).

Still check your server if it's not restricted. Than try to connect to the other server.

Here you can find the official documentation to FTP: http://tools.ietf.org/html/rfc959
some support might offer wikipedia, which is often well documentated and nicely explained.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.