Last active
August 29, 2015 14:02
-
-
Save slav123/481e9022e04054c7f230 to your computer and use it in GitHub Desktop.
parse doom against class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dom = new DOMDocument; | |
libxml_use_internal_errors(true); | |
if (!$dom->loadHTML($data)) { | |
echo 'failed to load DOM'; | |
} | |
$xpath = new DOMXPath($dom); | |
$entries = $xpath->query('//*[contains(concat(" ", normalize-space(@class), " "), " resultBody ")]/@id'); | |
$return = array(); | |
foreach ($entries as $entry) { | |
$return[] = substr($entry->nodeValue, 1); | |
} | |
return $return; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment