Hi all,
I have a site that for some reason was written to contain a list of links coded directly in the HTML and nor retrieved form a database. I would like to get the links to appear on two other sites I have on a news page. I found a curl function that got all the HTML form site A and put it in a variable. since the links I want are always coded as
<a href="http://
and the navigation links I don’t need are are all coded as
<a href="./
. I thought a regex to find all anchor tags that included the HTTP://
part would get it down to what I want and I could just loop through the array and output the list with any formatting needed. I have limited regex knowledge and have tried many of the examples found on google with no luck.
Basically I just want a regex that matches exactly
"<a href="http"{then anything and any length and ending in exactly}"</a>"
and be case insensitive.
The closest one I have was found on google and is as follows:
preg_match_all("/<a.*? href=(\"|')(.*?)(\"|').*?>(.*?)<\/a>/i",$html,$anchors);
but as soon as I add the "http after the equals sign it returns no results at all.
Thanks in advance.