PHP code for list files from webdav and allow for download
<p>I know there is a PHP class for accessing Webdav. How do I modify the code below to allow the users to click on the files to download?</p>

<pre><code>if (!class_exists('webdav_client')) {
 require('./class_webdav_client.php');
} 

$wdc = new webdav_client();
$wdc-&gt;set_server('demo.xxxxxx.com');
$wdc-&gt;set_port(80);
$wdc-&gt;set_user('demo');
$wdc-&gt;set_pass('demodemo');
// use HTTP/1.1
$wdc-&gt;set_protocol(1);
// enable debugging
$wdc-&gt;set_debug(false);


if (!$wdc-&gt;open()) {
  print 'Error: could not open server connection';
  exit;
}

// check if server supports webdav rfc 2518
if (!$wdc-&gt;check_webdav()) {
  print 'Error: server does not support webdav or user/password may be wrong';
  exit;
}

$dir = $wdc-&gt;ls('/');
</code></pre>



<pre><code>&lt;?php 
foreach($dir as $e) {
  $ts = $wdc-&gt;iso8601totime($e['creationdate']);
  $line = sprintf('&lt;tr&gt;&lt;td&gt;%s &lt;/td&gt;&lt;td&gt;%s &lt;/td&gt;&lt;td&gt;%s &lt;/td&gt;&lt;td&gt;%s &lt;/td&gt;&lt;td&gt;%s &lt;/td&gt;&lt;td&gt;%s &lt;/td&gt;&lt;td&gt;%s &lt;/td&gt;&lt;td&gt;%s &lt;/td&gt;&lt;td&gt;%s &lt;/td&gt;&lt;/tr&gt;',
          $e['href'], 
          $e['getcontentlength'], 
          date('d.m.Y H:i:s',$ts),
          $e['resourcetype'],
          $e['getcontenttype'],
          $e['activelock_depth'],
          $e['activelock_owner'],
          $e['activelock_token'],
          $e['activelock_type']
          );
  print urldecode($line);
}
?&gt;
</code></pre>
