Jump to content

html links


zawadi

Recommended Posts

[code]
preg_match_all('/<a href="(.*?)">(.*?)<\/a>/si',$html_text,$matches);
preg_match_all('/<a.*?href="(.*?)".*?>(.*?)<\/a>/si',$html_text,$matches);
[/code]

That should put the link(s) in the [b]$matches[/b] array.  The second one takes into consideration links with other "stuff" in them.  See [url=http://www.php.net/manual/en/function.preg-match-all.php]the manual page[/url] for this function for more information.
Link to comment
https://forums.phpfreaks.com/topic/13640-html-links/#findComment-52899
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.