If you search the manual long enough you're bound to find that somebosy has written if for you ;-)
This was contributed by rickyale@ig.com.br
at http://www.php.net/manual/en/function.preg-match-all.php:
<?
$url = "http://anydomainname/anyfile";
$contents = Implode("", File($url));
preg_match_all("|href=\"?([\"' >]+)|i", $contents,
$arrayoflinks);
//Listing the array
While(List(,$link) = Each($arrayoflinks[1]))
Echo "$link<Br>";
?>