Get directory listing from any URL
As far as I have read, PHP can only get the file listing from local server on which script is running.
What I need is the list of files in a directory on an external URL, which is not FTP but an HTTP URL, such as www.google.com. Is this possible in PHP?
Here is example of what I want开发者_运维问答 (but FDM is C++ app)!
You can only see this if the webserver allows it
This is not possible in any language.
If a remote server does not want to list directory contents (i.e. if it's configured not to), no external script can generate one; that would be insecure.
Free download manager does not show the files in the folder, but all the links found on the web page. You can get a web page with curl, and grab all links from it (using regular expressions), then download the linked pages - that's how web-spiders are build. But you cannot get list of the files that are on the server, only the one that are linked in a publicly available web-page.
You can see server files only if the server allows that option, alternative you have to install your own script that will do that work for you indepent of the server settings. That also means that you have to have access on the server that you like to list the files.
精彩评论