php-zip
php-zip copied to clipboard
Add files from remote
Description
PHP has a function called copy
copy get two parameters, source and destination.
We can use a remote file for source not a local file, like:
copy('http://someserver.com/somefile.zip','./somefile.zip')
Please add feature to add remote files for function addFile
Example
$zipFile = new \PhpZip\ZipFile();
try {
$zipFile
->addFile('http://192.168.98.242/store/0/2022/03/06/16/2022-03-06_16-33-06_131715438_7843520/2022-03-06_16-33-06_131715438_0_1_0_L1_P.jpg', './test.jpg')
->saveAsFile("/var/www/html/temp/temp.zip")
->close();
} catch (\PhpZip\Exception\ZipException $e) {
echo "Error: " . $e->getMessage();
} finally {
$zipFile->close();
}