Skip to content

Add files from remote #87

Description

@F50Ci37Y

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();
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions