Q: How to detect all the urls of a website? I wonder how to detect all the urls of a specified website, let's say, I know the website of https://stackoverflow.com/, how can I know that it has some urls  like https://stackoverflow.com/questions and https://stackoverflow.com/tags, is there a method or a tool to know the result?

A: There are some possibilities:


*

*If u don't want to write code you can use something like Xenu or Webspider to scan or save a website.

*If you want to use it as part of your own tool you can write it in PHP:
Directory listening on foreign server is on:
$dir = "stackoverflow.com/";
foreach(scandir($dir) as $file){
  print '<a href="'.$dir.$file.'">'.$file.'</a><br>';
}

*Directory listening is of:
Then you need to open the site per php_get_contents and filter for links per preg_match.
