How can i use opendir function to read the directory list of a remote server knowing its IP address?
For files/folders that are visible to the public you can do it with this script: No FTP, no strugglin. It will give you back all filenames in a remote folder. If you can open the folder with a browser, you can also read it with php. Happy leeching ;)
UPDATE: This only lists the files that are available for the public, for sure not files that are only visible for a certain user!
function get_text($filename) {
$fp_load = fopen("$filename", "rb");
if ( $fp_load ) {
while ( !feof($fp_load) ) {
$content .= fgets($fp_load, 8192);
}
fclose($fp_load);
return $content;
}
}
$matches = array();
preg_match_all("/(a href\=\")([^\?\"]*)(\")/i", get_text('http://www.xxxxx.com/my/cool/remote/dir'), $matches);
foreach($matches[2] as $match) {
echo $match . '
';
}