Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!isset($_GET['url']) || !filter_var($_GET['url'], FILTER_VALIDATE_URL)) exit('Incorrect url');
- $base_url = parse_url($_GET['url']);
- $base = $base_url['scheme'] . '://' . $base_url['host'];
- $html = file_get_contents($_GET['url']);
- if (!preg_match('/HTTP\/\d\.\d 2\d\d/', $http_response_header[0])) exit('Status: ' . $http_response_header[0]);
- printf("%-140s %s\n", $_GET['url'], $http_response_header[0]);
- if (!preg_match_all('/href=["\'](.+)["\']/Uis', strip_tags($html, '<a>'), $matches)) exit('No child urls found');
- foreach (array_unique($matches[1]) as $url) {
- $child = parse_url($url);
- if (!empty($child['scheme']) && !in_array(strtolower($child['scheme']), ['http', 'https'], true)) continue;
- if (!empty($child['host']) && strtolower($base_url['host']) != strtolower($child['host']) ) continue;
- if (strpos($url, $base) !== 0) $url = $base . '/' . ltrim($url, '/');
- printf(" %-138s %s\n", $url, get_headers($url)[0]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement