Trying to find the links on a page.
my regex is:
/]*href=(\\\"\\\'??)([^\\\"\\\' >]*?)[^>]*>(.*)<\\/a>/
The following is working for me and returns both href
and value
of the anchor tag.
preg_match_all("'\(.*?)\<\/a\>'si", $html, $match);
if($match) {
foreach($match[0] as $k => $e) {
$urls[] = array(
'anchor' => $e,
'href' => $match[1][$k],
'value' => $match[2][$k]
);
}
}
The multidimensional array called $urls
contains now associative sub-arrays that are easy to use.