title: Reading WordPress header.php/footer.php to a text string
body: <p>I am attempting to read the results of the executed header.php/footer.php files as a string of html. Here's the scenario:</p>
  
  <p>There are pages in the site that are developed in a .net environment but they want to share common headers/footers across the entire domain. They wish to have WordPress be the repository for this code and any time there is an update have a PHP cURL call to a .net web service and feed it the new HTML for the header/footers.</p>
  
  <p>I tried calling <strong>get_header()</strong> but that does not return a string (as I anticipated) so then I tried this test solution in functions.php:</p>
  
  <pre><code>function write_header() {
  $header_content = file_get_contents(get_bloginfo('wpurl').'/index.php' );
  $fp = fopen('c:\header.txt', 'a+');
  fwrite($fp, $header_content);//just testing the output, this will be a cURL call eventually.
  fclose($fp);
  }
  add_action( 'wp_update_nav_menu', 'write_header' );
  </code></pre>
  
  <p>It seems to be a very heavy handed method of getting the HTML since I'll have to do a lot of string manipulation to parse out the pieces I want. Is there a simpler way of doing this that I'm missing?</p>