I\'m kinda new to PHP.
I\'ve got two different hosts and I want my php page in one of them to show me a directory listing of the other. I know how to work with opend
I was unable to get the FTP suggestions to work so I took a more unconventional route, basically it yanks the html from the "Index of" page and extracts the filenames.
Index page:
Extraction code:
$dir = "http://www.yoursite.com/files/";
$contents = file_get_contents($dir);
$lines = explode("\n", $contents);
foreach($lines as $line) {
if($line[1] == "l") { // matches the - tag and skips 'Parent Directory'
$line = preg_replace('/<[^<]+?>/', '', $line); // removes tags, curtousy of http://stackoverflow.com/users/154877/marcel
echo trim($line) . "\n";
}
}