I need to download images from other websites to my server. Create a ZIP file with those images. automatically start download of created ZIP file. once download is complete the ZIP file and images should be deleted from my server.
Instead of automatic download, a download link is also fine. but other logic remains same.
Well, you'll have to first create the zipfile, using the ZipArchive
class.
Then, send :
header()
-- there is an example on that manual's page that should helpreadfile()
And, finally, delete the zip file from your server, using unlink()
.
This just in case your normal PHP script is, sometimes, interrupted, and doesn't delete the temporary file.