PHP code example of becklyn / webdav

1. Go to this page and download the library: Download becklyn/webdav library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

becklyn / webdav example snippets


$client = new \Becklyn\WebDav\Client(new \Becklyn\WebDav\Config(
    'base_url',
    'username',
    'password'
));

$files = $client->listFolderContents('path/to/folder');

foreach ($files as $file) {
    if ($file instanceof \Becklyn\WebDav\Resource\File) {
        file_put_contents("/tmp/{$file->path()}", $client->getFileContents($file));    
    }
}