title: php xpath get contents of div with class
body: <p>What is the right syntax to use xpath to get the contents of all divs with a certain class? i seem to be getting the divs but i don't know how to get their innerHTML. </p>
  
  <pre><code>        $url = "http://www.vanityfair.com/politics/2012/10/michael-lewis-profile-barack-obama";
  
      $ctx     = stream_context_create(array('http'=&gt; array('timeout' =&gt; 10)));
  
      libxml_use_internal_errors(TRUE);
      $num = 0;
  
      if($html = @file_get_contents($url,false,$ctx)){
  
          $doc   = DOMDocument::loadHTML($html);
          $xpath = new DOMXPath($doc);
  
          foreach($xpath-&gt;query('//div[@class="page-display"]') as $div){
              $num++;
              echo "$num. ";
  
              //????
  
              echo "&lt;br/&gt;";
          }
  
          echo "&lt;br/&gt;FINISHED";
  
      }else{
          echo "FAIL";
      }
  </code></pre>