When I run:
$url='foldername';
$dir = opendir($url);
//List files in images directory
while (($file = readdir($dir)) !== false)
{
echo "filename: " . $file . "<br />";
}
closedir($dir);
...it outputs:
filename: a.gif
filename: file.html
filename: g.gif
filename: gg.html
I would like to see all the files and folders on another server from the URL:
$url="http ://example.com"
How do I find the files and folder names from example.com
?
It is possible. Just got to go outside the box. Only flaw with this is index output
<?
$matches = array();
preg_match_all("/(a href\=\")([^\?\"]*)(\")/i", get_text('http://www.website.com/ images/'), $matches);
foreach($matches[2] as $match)
{
echo $match . '<br>';
}
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;
}
}
?>
http://
does not support directory listing. What you're trying to do is impossible.
It's impossible of course, otherwise websites would be much more vulnerable since anyone could explore their directories tree!
If you have another way of accessing that website (e.g. if it's yours), like FTP or SSH, it becomes possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With