Find Links in HTML


/ Published in: PHP
Save to your folder(s)

Will find all links in a given string containing html


Copy this code and paste it in your HTML
  1. <?
  2. function return_links($in_string) {
  3. preg_match_all("/<a(?:[^>]*)href=\"([^\"]*)\"(?:[^>]*)>(?:[^<]*)<\/a>/is", in_string, $matches);
  4. return $matches;
  5. }
  6. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.