title: Display only certain HTML using PHP's DOMDocument
body: <p>I am looking to draw html of a webpage inside my website. </p>
  
  <p>Take this scenario:</p>
  
  <p>I have a website that checks availability of a hotel. But instead of hosting that hotel's images on my server. I simple curl, a specific page on the hotels website that contains their images. </p>
  
  <p>Can I grab anything from the html and display it on my website? using their HTML code, but only the div(s) or images that i want to display?</p>
  
  <p>I'm using this code, sourced from:</p>
  
  <p><a href="http://davidwalsh.name/download-urls-content-php-curl" rel="nofollow">http://davidwalsh.name/download-urls-content-php-curl</a></p>
  
  <p>As practice and arguments sake, lets try and display Google's logo from their homepage.</p>
  
  <pre><code>function get_data($url)
  {
      $ch = curl_init();
      $timeout = 5;
      curl_setopt($ch,CURLOPT_URL,$url);
      curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
      curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
      $data = curl_exec($ch);
      curl_close($ch);
      return $data;
  }
  
  $returned_content = get_data('http://www.google.com');
  echo '&lt;base href="http://www.google.com/" /&gt;';
  echo $returned_content;
  </code></pre>
  
  <p>Thanks to @alex I have started to play with DOMDocument in PHP's lib. However, I have hit a snag.</p>
  
  <pre><code>    function get_data($url)
  {
      $ch = curl_init();
      $timeout = 5;
      curl_setopt($ch,CURLOPT_URL,$url);
      curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
      curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
      $data = curl_exec($ch);
      curl_close($ch);
      return $data;
  }
  
  $url = "www.abc.net.au";
  $html = get_data($url);
  
  $dom = new DOMDocument;
  @$dom-&gt;loadHTML($html);
  $logo = $dom-&gt;getElementById("abcLogo");
  var_dump($logo);
  </code></pre>
  
  <p>Returns: <code>object(DOMElement)[2]</code></p>
  
  <p>How do I parse this further? Or Simply just print/echo the contents of the DIV with that id..?</p>