title: Get all a href links using SimpleHTMLDom library & change these on the 'fly'
body: <p>I'd like to get to all the a href links within the html string and convert all of the links as follows:</p>
  
  <pre><code>&lt;a href='www.google.com'&gt;Google&lt;/a&gt;
  </code></pre>
  
  <p>Would change to look like this...</p>
  
  <pre><code>&lt;a href='www.mysite.com/link.php?URL=www.google.com'&gt;Google&lt;/a&gt;
  </code></pre>
  
  <p>Can anyone suggest how I do this?</p>
  
  <pre><code>&lt;?php
  </code></pre>
  
  <p>require_once('simple_html_dom.php');</p>
  
  <pre><code>// load the class
  $html = new simple_html_dom();
  
  // load the entire string containing everything user entered here
  
  $string = "&lt;html&gt;&lt;body&gt;&lt;base href='http://www.site.biz/clients/g/'&gt;&lt;a href='www.google.co.uk'&gt;Google&lt;/a&gt;&lt;a href='http://www.yahoo.co.uk'&gt;Yahoo&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;";
  $return = $html-&gt;load($string);
  
  $links = $html-&gt;find('a');
  
  foreach ($links as $link) 
  {
      var_dump($link);
  }
  </code></pre>
  
  <p>?></p>