As far as I know, this is impossible. To read the contents of a directory with opendir(), you must be able to access the filesystem of the machine, and you can only do this if you're accessing the same machine that the PHP script is running on. I don't even think opendir() would understand if you put an URI in rather than a filesystem path, but even if it did, when you request an URI from another server you're stuck with whatever response the server gives you; you can't access its filesystem.