title: Dynamic link with absolute URI gets changed to localhost
body: <pre class="lang-php prettyprint-override"><code>$refPointer = $site_to_be_extracted . $a-&gt;href;
  echo $refPointer . '&lt;br&gt;';
  </code></pre>
  
  <p>generates in output (Chrome browser): </p>
  
  <pre class="lang-none prettyprint-override"><code>http://www.hackingwithphp.com/1/1/0/is-this-book-for-you
  </code></pre>
  
  <p>You would expect the following line to generate a correct <code>&lt;a&gt;</code> tag. That is a correct link</p>
  
  <pre class="lang-php prettyprint-override"><code>print '&lt;a href=' . $refPointer . '&gt;' . $a . '&lt;/a&gt;';
  </code></pre>
  
  <p>Instead it generates in output:</p>
  
  <pre class="lang-none prettyprint-override"><code>localhost/1/1/0/is-this-book-for-you
  </code></pre>
  
  <p>So both the <strong>protocol</strong> (HTTP) and the <strong>$site_to_be_extracted</strong> (www.hackingwithphp.com) are lost. And replaced by "localhost"<br>
  Why? What could be the problem</p>
  
  <p>This is the function where it's all happening. Now it works fine</p>
  
  <pre class="lang-php prettyprint-override"><code>        include('simple_html_dom.php');
          .
          .
          function createChapterContent ($site_to_be_extracted,     $chapter_to_be_extracted) {
          $html = file_get_html($chapter_to_be_extracted);
          $refPointer;
              foreach($html-&gt;find('ol') as $ol) {                                 
              foreach($ol-&gt;find('li') as $li) {
                  // echo '&lt;br&gt;' . $li-&gt;innertext ;
                  foreach($li-&gt;find('a') as $a) {
      // Original. Causing the reported problem
      // $refPointer = $site_to_be_extracted . $a-&gt;href;
      //    echo $refPointer . '&lt;br&gt;';
      // changed to (see below). Now the output is correct
      // Why?
                      $a-&gt;href = $site_to_be_extracted . $a-&gt;href;
                      $refPointer = $a-&gt;href;
                      print '&lt;a href=' . $refPointer . '&gt;' . $li-&gt;innertext . '&lt;/a&gt;' . '&lt;br&gt;';
                      break;
                  }; 
              }
          }
  </code></pre>