zawadi Posted July 4, 2006 Share Posted July 4, 2006 ok, I have an html file and I need to get the links in it out. But I dont know PHP well to do it, all I want is the HREF"" bit and the link textHELP please :) Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 4, 2006 Share Posted July 4, 2006 [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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.