How to get a list of site directories in Denver using php ?

    1 answer 1

     <?php $file = file('/usr/local/apache/conf/vhosts.conf'); foreach ($file as $line) { if (preg_match('/^[^#]* <VirtualHost \s+ [^:>]+ (?::(\d+))?/six', $line, $p)) { $port = @$p[1]; } if (preg_match('/^[^#]* ServerName \s+ "?([^"]*)"?/six', $line, $p)){ if ($port == 443) continue; $dom = preg_replace('/^www\./si', '', $p[1]); $dom .= $port && $port != 80? ":$port" : ""; $domains[$dom] = join(".", array_reverse(preg_split('/\./', $dom))); } } asort($domains); $prev = false; foreach ($domains as $dom=>$parts) { if (!$prev || !preg_match('/'.preg_quote($prev, '/').'$/si', $dom)) { echo "<a href=\"http://{$dom}\"><b>{$dom}</b></a></br>"; $prev = $dom; } else { print "<dd><a href=\"http://{$dom}\">{$dom}</a><br /></dd>"; } } ?> 

    There is a file in the \WebServers\denwer\www\denwer\Tools\sitelist\ index.php file that lists the domains for the link http: //localhost/denwer/Tools/sitelist/index.php