I am trying to get all the files of an Apache2 Direotry Listing to create AJAX-Requests tp each of them. But I can't find a RegExp to match in .
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
$dir = 'http://www.example.com/directory';
$data = new DOMDocument();
@$data->loadHTMLFile($dir);
$links = array();
foreach($data->getElementsByTagName('a') as $link)
{
$url = $link->getAttribute('href');
if ($url[0] !== '?') // skip column links
{
$links[] = $url;
}
}
print_r($links);