With reference to this post from me a few days ago, I am trying to write a simple php page to take a URL, username and password and to then load a list of all files that could be restored with tick boxes and a “select all” button (maybe also some date to / from options as well later).
I’ve got the code working to pull the “capabilities” from the server and that seem to be working well but I’m not currently managing to get the dav trash-bin stuff working. Code is below, could someone take a quick look and point me to where I am going wrong?
$apiUrl = ‘https://’ . $fqdn . ‘remote.php/dav/trash-bin/’ . $username;
// also tried
// $apiUrl = ‘https://$username:$password@$fqdn/remote.php/dav/trash-bin/$username’;
$apiCurl = curl_init();
curl_setopt($apiCurl, CURLOPT_USERPWD, $userUsername . “:” . $userPassword);
curl_setopt($apiCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($apiCurl, CURLOPT_URL, $apiUrl);
curl_setopt($apiCurl, CURLOPT_HTTPHEADER, array(’
curl_setopt($apiCurl, CURLOPT_CUSTOMREQUEST, ‘PROPFIND’);
<d:propfind xmlns:d=“DAV:” xmlns:oc=“http://owncloud.org/ns”>
$curlResult = curl_exec($apiCurl);
$deletedFiles = json_decode($curlResult, true);
Any help would be appreciated, fairly sure I’m just not getting something quite right in the curl options / headers / post settings.