36 lines
1.8 KiB
PHP
36 lines
1.8 KiB
PHP
<?php
|
|
|
|
use App\Api\Webdav\Client;
|
|
|
|
require __DIR__.'/vendor/autoload.php';
|
|
|
|
$client = new Client(
|
|
server: "http://127.0.0.1:9977", // URL de nextcloud, ici c'est un proxy qui capture les requêtes/réponses HTTP
|
|
baseUrl: "/remote.php/dav/files/myUsername",
|
|
username: "myUsername",
|
|
password: "my-application-password",
|
|
);
|
|
|
|
$client->ls("/");
|
|
// Request: https://privatebin.deblan.org/?66febc015c225eca#J3vZ4kiETeoWbT4tzMTXohGFcsoXNJF1oGcwsV4Xzrf2
|
|
// Response: https://privatebin.deblan.org/?9ca392dfc51031e0#G1F9yp6UaMxdnjERLK21CXUAWhfmy95sGZiymhCumDAB
|
|
|
|
$client->rm('/Nextcloud%20intro.mp4');
|
|
// Request: https://privatebin.deblan.org/?a5d6ba25ba3f51fe#BgCwDoivjqNxbBunNG4ys3SUKLCZmoN5ksmu216YtiNH
|
|
// Response: https://privatebin.deblan.org/?841a24dd6fad7ba0#7QENgLxesydSXQhVv3YouaXLjVcroKZUZDFSKKiMZik
|
|
|
|
$client->mv('/Nextcloud.png', '/foo.png');
|
|
// Request: https://privatebin.deblan.org/?d978bf3ccd75eefb#GYbT9Ba6dnXrQSdAipcemwgGPpGpPPiqdyjnHMB6WUd3
|
|
// Response: https://privatebin.deblan.org/?74a72a4e32b29153#9yoWpodeE365NftiiZ5jafPVafJiJPGbM4UHVqev986A
|
|
|
|
$client->sendFile('newfile.txt', '/newfile.txt');
|
|
// Request: https://privatebin.deblan.org/?1ff6666b3b95b02c#BY5vLoFjGHw8xMChWJwuSrGycsQSo86iewczP9uKgdYd
|
|
// Response: https://privatebin.deblan.org/?6049b0c478947bea#9ZWzVMXvfSWiMguXmx63qwogYR8HZDZjqWL9Rb2mNk8v
|
|
|
|
$client->get('/newfile.txt');
|
|
// Request: https://privatebin.deblan.org/?409193e4233d0682#7LiQe4Dpm1u5RuuWbCkXEPhSuejVhFDTZ11gGyxFWJho
|
|
// Response: https://privatebin.deblan.org/?44860aca2cd519a8#6c1ABAq6zpLKdkNvttxqvKjnZ5yyoKPvmjp2X8p1a7sY
|
|
|
|
$client->mkdir('/NewDir');
|
|
// Request: https://privatebin.deblan.org/?43b69b23868f22c8#88U8HhFhC7hgJLabTuQBgMLDCmfTga22aQANbwtM9dX4
|
|
// Response: https://privatebin.deblan.org/?92f8b0c79ea67e2d#BtHcaQuUBroAFku1FXCuZwmupYenC697zFQrfsXQtZhC
|