Press "Enter" to skip to content

Show all links on a webpage

]*?href[\s]?=[\s\”\’]+”.
“(.*?)[\”\’]+.*?>”.”([^<]+|.*?)?<\/a>/”,
$var, &$matches);

$matches = $matches[1];
$list = array();

$string = “”;
$total = 0;
foreach($matches as $var)
{
if (preg_match(‘/^http:\/\//’, $var) || preg_match(‘/^ftp:\/\//’, $var)) {
$total++;
$string .= $total.”.) “.$var.”
“;
}
}
echo “

“;
if ($total != 0 || $total != 1) print(“

Total of “.$total.” links found.

“);
else print(“

Total of “.$total.” link found.

“);
print(“
“);
print($string);

} else {
echo ”

Get all links found on the following webpage:



“;
}
echo “

“;