$http_status = $wdc->mkcol($test_folder); print 'webdav server returns ' . $http_status . '<br>'; // put a file to webdav collection $filename = './Testfiles/test_ref.rar'; print 'Let\'s put the file ' . $filename . ' using webdav::put into collection...<br>'; $handle = fopen($filename, 'r'); $contents = fread($handle, filesize($filename)); fclose($handle); $target_path = $test_folder . '/test 123 456.rar'; $http_status = $wdc->put($target_path, $contents); print 'webdav server returns ' . $http_status . '<br>'; // --- $filename = './Testfiles/Chiquita.jpg'; print 'Let\'s Test second put method...<br>'; $target_path = $test_folder . '/picture.jpg'; $http_status = $wdc->put_file($target_path, $filename); print 'webdav server returns ' . $http_status . '<br>'; // --- print 'Let\'s get file just putted...'; $http_status = $wdc->get($test_folder . '/picture.jpg', $buffer); print 'webdav server returns ' . $http_status . '. Buffer is filled with ' . strlen($buffer) . ' Bytes.<br>'; // --- print 'Let\'s use method webdav_client::copy to create a copy of file ' . $target_path . ' the webdav server<br>'; $new_copy_target = '/copy of picture.jpg'; $http_status = $wdc->copy_file($target_path, $new_copy_target, true); print 'webdav server returns ' . $http_status . '<br>'; // -- print 'Let\'s use method webdav_client::copy to create a copy of collection ' . $test_folder . ' the webdav server<br>'; $new_copy_target = '/copy of wdc test 2 folder'; $http_status = $wdc->copy_coll($test_folder, $new_copy_target, true); print 'webdav server returns ' . $http_status . '<br>';
if ( !$wdc->open() ) { print 'Error: could not open server connection <br /> \r\n'; exit; } // check if server supports webdav rfc 2518 if ( !$wdc->check_webdav() ) { print 'Error: server does not support webdav or user/password may be wrong <br /> \r\n'; exit; } $http_status = $wdc->mkcol( "/backups" ); $http_status = $wdc->put_file( "/backups/" . "test.zip", "test.zip" ); print 'webdav server returns ' . $http_status. "<br/ > \r\n"; $urlToThePublishedFile = $wdc->filePublish( "/backups/test.zip" ); print 'link to the published file: ' . $urlToThePublishedFile. "<br/ > \r\n"; $fileUnpublishinStatus = $wdc->fileUnPublish( "/backups/test.zip" ); if ( $fileUnpublishinStatus ) { echo "File UnPublished correctly <br /> \r\n"; } else { echo "Some errors occured on file UnPublish <br /> \r\n"; } if ( $wdc->get_file( "/soutcast/woman/gogo/2_1.jpg", "1.jpg" ) )