My PHP curl request gets an XML response like this:
<feed>
<openSearch:totalResults>0</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>10</openSearch:itemsPerPage>
<openSearch:Query role="correction" searchTerms="BINGO"/>
</feed>
After I parse it with SimpleXML_load_string() I want to access the attribute 'searchTerms' in the last openSearch:Query node. How can I get this?
I tried:
$xml = simplexml_load_string($result);
$searchTerms = $xml->openSearch->Query->searchTerms; // empty value
$searchTerms = $xml->openSearch:Query->searchTerms; // syntax error, unexpected ':'
$searchTerms = $xml->openSearch[3]->searchTerms; // empty value
$searchTerms = $xml->openSearch[3]['searchTerms']; // empty value
thank you for your assistance.