Hi...
I am trying to retrieve from a local page a list of links and linked text into an array...
I would like that something like:
<a href='localhost/foo.php'><b>Click here to see foo</b></a>
would return
$links[0]=Array('localhost/foo.php',<b>Click here to see foo</b>);
ecc. ecc.
(I am not setting an associative array, becouse I don't want the same url if found twice, to overwrite the previous record)
I have found this code that matches links:
preg_match_all("'<a\s+href\s=\s # find <a href=
([\"\'])? # find single or double quote
(?(1) (.*?)\1 | ([\s>]+)) # if quote found, match up to next matching
quote, otherwise match up to next space
'isx",$document,$links);
Still, I can't figure out how to achieve what I am after...
Any hint??
TIA
Sergio