Question: I have a url, `http://www.mysite.com/images` and the `images` directory allows Directory Listings. How can I get the files in that directory with PHP?

Answer: 
You need FTP access (an FTP account to that URL). If you have this, then you can log into the server with FTP and use:

```
opendir()

```

and

```
readdir()

```

to accomplish what you are trying to do.

---

If you do not have access to the server, you will need to scrape the site's HTML, and it gets more complex -> so I can let somebody else tackle that one... but google search "scrape html site" or something similar, there are plenty of pre-written functions that can do similar things.

i.e.
<http://www.thefutureoftheweb.com/blog/web-scrape-with-php-tutorial>

<http://www.bradino.com/php/screen-scraping/>
// tho a late-comer, this one seems a bit more reader-friendly if not faster

```
$url = 'http://whatevasite/images/';
$no_html = strip_tags(file_get_contents($url));
$arr = explode('Parent Directory', $no_html);
$files = trim($arr[1]);
$files = explode("\n ", $files);
var_dump($files);

```