title: How to insert link tags between head tags on HTML using SimpleHtmlDom
body: <p>I'm trying to manipulate HTML codes by the use of <a href="http://simplehtmldom.sourceforge.net" rel="nofollow">simplehtmldom.sourceforge.net</a>. This is i've got so far. I could create a new file or turn the <em>index.html</em> to <em>index.php</em> and copy the head tag from the index.html. The problem is, how could I insert the link tags:</p>
  
  <pre><code>&lt;link href="style.css" rel="stylesheet" type="text/css" /&gt;
  </code></pre>
  
  <p>between the head tags? </p>
  
  <pre><code>&lt;?php
  # create and load the HTML
  include('simple_html_dom.php');
  // get DOM from URL or file
  $html = file_get_html('D:\xampp\htdocs\solofile\index.html');
  $indexFile ='index.php';
  $openIndexFile = fopen($indexFile,'a');
  //find head tag
  foreach($html-&gt;find('head') as $e)
  {
   $findHead = $e-&gt;outertext;
   fwrite($openIndexFile, "\n" .$findHead. "\n");
  }
  </code></pre>