Accessing XML/PHP with period in tag
- by LuckyShot
Hi guys,
Quick newbie question here, how do I access totalResults?
XML
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription>
<opensearch:totalResults>1</opensearch:totalResults>
<posts>
<post>
<score>10</score>
</post>
</posts>
</OpenSearchDescription>
To access the score I would do this:
PHP
$xmlObj = simplexml_load_string($theXMLabove);
echo $xmlObj->posts->post[0]->score;
But none of these work for the totalResults:
echo $xmlObj->opensearch:totalResults;
echo $xmlObj->opensearch->totalResults;
Sorry for asking such a lame question...
Documentation on how to traverse XML with PHP is also appreciated :)
Thanks!