How to get the child directory and file names of the website
If we know the URL, can we access the names of the files inside the parent directory. Like we do in dos, when we enter a folder we can view the list of files inside that directory by giving command
DIR
For Eg., If we have URL like http://www.ahilam.com . I want to know what are the files and folders inside the ahilam.com such as http://www.ahilam.com/courses开发者_如何学JAVA, http://www.ahilam.com/login.php and so on....
This looks silly question. But eager to know whether it is possible
This is usually not possible: HTTP has no directory listing function built in.
There is Apache's DirectoryListing
directive that outputs a formatted HTML list of all files in a directory, but it is usually turned off.
The best you can do is crawl the URL's main page for any links. It is not guaranteed, though, that you will catch all existing files that way.
Yes you can do this. The thing which you actually want to do is web directory traversal.. It is a kind of web vulnerability which is usually taken in to consideration by the web master so you get 403-Forbidden or 404-Not Found Error. Manual exploitation on this is surely possible. For automation You can take use of Python/Perl for ease of use. I am personally working on a same project targeting the same objective using PHP and cURL. At very present I can not help about any source code but for sure I'll be posting same.
Different web servers will provide different browse functions when you access a directory directly, and many will allow (indeed encourage) this to be disabled altogether. So the quick answer is: no, it's not possible.
Take a look at the Directory Class.
精彩评论