fork download
  1. <?php
  2.  
  3. $data = <<<DATA
  4. <div id="plugin-description">
  5. <p itemprop="description" class="shortdesc">
  6.   BuddyPress helps you build any type of community website using WordPress, with member profiles, activity streams, user groups, messaging, and more.
  7.   </p>
  8.   <div class="description-right">
  9.   <p class="button">
  10.   <a itemprop="downloadUrl" href="https://d...content-available-to-author-only...s.org/plugin/buddypress.2.6.1.1.zip">Download Version 2.6.1.1</a>
  11.   </p>
  12.   </div>
  13. </div>
  14. DATA;
  15.  
  16. $dom = new DOMDocument();
  17. $dom->loadHTML($data);
  18.  
  19. $xpath = new DOMXPath($dom);
  20. $containers = $xpath->query("//div[@id='plugin-description']");
  21.  
  22. foreach ($containers as $container) {
  23. $description = trim($xpath->query(".//p[@itemprop='description']", $container)->item(0)->nodeValue);
  24. $link = $xpath->query(".//a[@itemprop='downloadUrl']/@href", $container)->item(0)->nodeValue;
  25. echo $description . $link;
  26. }
  27. ?>
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
BuddyPress helps you build any type of community website using WordPress, with member profiles, activity streams, user groups, messaging, and more.https://d...content-available-to-author-only...s.org/plugin/buddypress.2.6.1.1.zip