Free Online Tools

Broken link checker

Enter URL   
]*>.*?#ims","",$content); $basehref = false; if(preg_match("#]*>|\\s+>|>)#si",$content,$matches)) { $basehrefurl = $matches[1]; $basehrefurl = preg_match("#^('|\")(.*)\\1#i",$basehrefurl,$m) ? $m[2] : $basehrefurl; if(!preg_match("#^https?://#i",$basehrefurl)) { if(strpos($basehrefurl,"/")===0) { $basehrefurl = $basehrefurl.$dirurl; } else { $basehrefurl = (strrpos($basehrefurl,"/")===strlen($basehrefurl)-1 ? $basehrefurl : $basehrefurl."/" ).$dirurl; } } preg_match("#(^.+?://.+?)(/.*$|$)#",$basehrefurl,$basehrefroot); $basehrefroot = $basehrefroot[1]; $basehref = true; } preg_match_all("#<(\\w+) [^>]*?(href|src)=(\\S*?)(?:\\s+[^>]*>|\\s+>|>)#si",$content,$matches); $resources = array(); foreach($matches[2] as $k=>$v) { $resources[$v][] = preg_match("#^('|\")(.*)\\1#i",$matches[3][$k],$m) ? $m[2] : $matches[3][$k]; } $total = 0; foreach($resources as $i=>$res) { foreach($res as $k=>$v) { if(preg_match("#^(\\w+?)://#",$v)) { continue; } if(preg_match("#^(\\w+?):#",$v)) { unset($resources[$i][$k]); continue; } if(strpos($v,"?")===0) { $resources[$i][$k] = $basehref ? $basehrefurl.$v : $baseurl.$url['path'].$v; continue; } if(strpos($v,"/")===0) { $resources[$i][$k] = $basehref ? $basehrefroot.$v : $baseurl.$v; continue; } else { $resources[$i][$k] = $basehref ? $basehrefurl.$v : $baseurl."/".$v; continue; } } $total += count($res); } echo "
Total: $total
"; foreach($resources as $i=>$res) { foreach($res as $k=>$v) { $i = strtoupper($i); $ve = urlencode($v); echo << EOF; } } echo "
($i) $v
"; } ?>