title: PHP Simple HTML DOM Parser: how to get contents of the parent div containing <h1> tags?
body: <p>I'm scraping (using PHP simple HTML DOM) a number of different (news) sites with the aim of getting the main content/body of text on the page. </p>
  
  <p>To do this the best way i could figure out was to find the main header/headline (H1) and to get the text contained within the same div as this header tag.</p>
  
  <p>How would i go about getting the contents of the whole (parent?) div, in both examples below.</p>
  
  <pre><code>&lt;div&gt;  &lt;----- need to get contents of this whole div (containing the h1 and likely the main body of text)
    &lt;h1&gt;&lt;/h1&gt;
    main body of text here
  &lt;/div&gt;
  </code></pre>
  
  <p>Div maybe be further up the tree.</p>
  
  <pre><code>&lt;div&gt; &lt;----- need to get contents of this whole div
    &lt;div&gt;   
      &lt;h1&gt;&lt;/h1&gt;
    &lt;/div&gt;
  
    &lt;div&gt;
      main body of text here
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Div even further up the tree.</p>
  
  <pre><code>&lt;div&gt; &lt;----- need to get contents of this whole div
    &lt;div&gt;
  
      &lt;div&gt;   
        &lt;h1&gt;&lt;/h1&gt;
      &lt;/div&gt;
  
      &lt;div&gt;
        main body of text here
      &lt;/div&gt;
  
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Then i could compare the size of each, and determine the main div.</p>