fork(2) download
  1. <?php
  2. $html = <<<HTML
  3. <body>
  4. <div class='post-body entry-content' id='post-body-37'>
  5. <div style="text-align: left;">
  6. <div style="text-align: center;">
  7. Hi
  8. </div></div></div>
  9. </body>
  10. HTML;
  11. $dom = new DOMDocument;
  12. $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD);
  13. $xp = new DOMXPath($dom);
  14. $links = $xp->query('//div[starts-with(@class,"post-")]');
  15. foreach ($links as $link) {
  16. echo $link->nodeValue;
  17. }
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout


Hi