There's always more than one way to do something, but here's a simple way to do it:
Code:
// Load the page into an array. The following will assign each line as an array element
$my_file = file("document.html");
// Now loop through the document lines
while ($file_line = each($my_file))
{
// Check to see if this line contains a link
if (ereg("<a href=",$file_line[value]))
{
// If it does, get rid of the junk preceeding and following the URL
str_replace('.*<a href=','',$file_line[value]);
str_replace('</a>.*','',$file_line[value]);
// Then push it onto a new array
array_push($array,$file_line[value]);
}
} This will work but it probably isn't very thorough (since I wrote it in a hurry and I've been drinking tonight). It won't grab any more than one link from a single line, and it also will not work for links where the opening and closing tags are not on the same line, but maybe it will help to get you pointed in the right direction.