I am trying to get a list of files from a directory thorough PHP. I also tried via glob, but doesn't work with HTTP, tried recursively and this is the latest script I managed to found. Just that it doesn't work. it doesn't display the files.
<?php
$url = 'removed for security puposes';
$html = file_get_contents($url);
$count = preg_match_all('/<td><a href="([^"]+)">[^<]*<\/a><\/td>/i', $html, $files);
for ($i = 0; $i < $count; ++$i) {
echo "File: " . $files[1][$i] . "<br />\n";
}
var_dump($files);
?>
The var_dump($files);
is output
array(2) {
[0]=> array(0) {
}
[1]=> array(0)
{ }
}
So what am I mistaking.
` and `- ` you're targeting.