loadHTMLFile($path); foreach ($dom->getElementsByTagName('a') as $a) { $href = $a->getAttribute('href'); //echo "href " . $href . "\n"; if (!$href || substr($href, 0, 4) === 'http' || substr($href, 0, 2) === '..' || strpos($href, '#') !== false) continue; if (substr($href, -4) === '.htm' || substr($href, -5) === '.html') download(preg_replace('@[^/]*$@', $href, $path, 1)); } if (preg_match_all('@SRC = "([^"]+\.htm)"@', file_get_contents($path), $m)) { foreach ($m[1] as $href) { $href = preg_replace('@[^/]*$@', $href, $path, 1); //echo "frame " . $href . "\n"; download($href); } //print_r($m); } foreach ($dom->getElementsByTagName('img') as $img) { $src = $img->getAttribute('src'); //echo "src " . $src . "\n"; if (!$src || substr($src, 0, 4) === 'http' || substr($src, 0, 2) === '..') continue; dl_img(preg_replace('@[^/]*$@', $src, $path, 1)); } /*if (preg_match_all('@\.src = "([^"]+\.JPG)"@', file_get_contents($path), $m)) { foreach ($m[1] as $src) { dl_img(preg_replace('@[^/]*$@', $src, $path, 1)); } //print_r($m); }*/ } download('index2.htm'); ?>