title: PHP retrieve inner HTML as string from URL using DOMDocument
body: <p>I've been picking bits and pieces of code, you can see roughly what I'm trying to do, obviously this doesn't work and is utterly wrong:</p>
  
  <pre><code>&lt;?php
  
  $dom= new DOMDocument();
  $dom-&gt;loadHTMLFile('http://example.com/');
  $data = $dom-&gt;getElementById("profile_section_container");
  $html = $data-&gt;saveHTML();
  echo $html;
  
  ?&gt;
  </code></pre>
  
  <p>Using a CURL call, I am able to retrieve the document URL source:</p>
  
  <pre><code>function curl_get_file_contents($URL)
  {
  $c = curl_init();
  curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($c, CURLOPT_URL, $URL);
  $contents = curl_exec($c);
  curl_close($c);
  
  if ($contents) return $contents;
  else return FALSE;
  }
  
  $f = curl_get_file_contents('http://example.com/'); 
  echo $f;
  </code></pre>
  
  <p>So how can I use this now to instantiate a DOMDocument object in PHP and extract a node using <strong>getElementById</strong></p>