rendered paste body<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Spider</title></head><body><?php $try = 0; $links = array(); function parse_page($www) { global $try, $links, $alkup; $try++; $alkup = $www; $file = file_get_contents($www); $file = preg_replace("/\\<(!DOCTYPE|html)(.+?)\\>/","",$file); preg_replace("/\"(.+?)\"/se","add_link(\"\\0\")",$file); } function hanki_pelkka_path($www) { if (preg_match("/\\/$/",$www)) return $www; $www = preg_replace("/^(.*)\\/(.+?)$/","\\1/",$www); return $www; } function add_link($www) { global $links, $alkup; $www = str_replace("\"","",$www); // Sopiva linkki? if (preg_match("/^(http|https|ftp):\\/\\//",$www)) { $sopii = true; } elseif (preg_match("/(html|php|\\/)$/",$www)) { $sopii = true; $www = hanki_pelkka_path($alkup).$www; } else { return ''; } $links[] = $www; } $links[] = "http://localhost/frozenblog/"; $i = 0; while ($i <= count($links) AND $try < 10) { $link = $links[$i]; print "Parseroidaan linkkiä $link (I: $i) \n<br />"; parse_page($link); $i++; } print_r($links);?></body></html>