I want to pull a web page into a string, and scan through to extract every URL embedded in an anchor tag into an array.
I figure the best way to do this is using a preg_match, but I'm not that great with regular expressions.
let's say I have a page like this:
PHP Code:
<html>
<body>
some text <a href=http://www.codenewbie.com>some link</a> .
<br><br>
here is another <a href="http://www.code400.com"> another link</a>.
<br><br>
and another link <a href="forum.php">forum</a>.
i can get all that into a string, but what would i use to extract only the links into an array? it would end up something like this:
PHP Code:
<?
$array[0]="http://www.codenewbie.com";
$array[1]="http://code400.com";
$array[2]="forum.php";
?>
any help would be appreciated.
Thanks in advance
Jimmy