Code: Select all
$xmlstr = html_entity_decode(file_get_contents($items_url), ENT_NOQUOTES, 'UTF-8');
$xml = simplexml_load_string($xmlstr);
if ($xml) {
echo "\n<p>";
foreach ($xml->body as $s) {
echo "got body node: " . $s->div[0]->div[0]->h2;
} /* WORKS */
foreach ($xml->xpath('body') as $s) {
echo "got body node with xpath: " . $s->div[0]->div[0]->h2;
} /* DOESN'T WORK: returned $s is FALSE */
echo "\n</p>";
}