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.

Thanks,
Pasquale

Recommended Answers

All 3 Replies

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?

Pasquale

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.