I'm wondering how to parse values in XML that appear to have : in their name. I've been using:
$response = file_get_contents($url);
$data = simplexml_load_string($response);
then doing a:
foreach($data->item as $key => $current){
However, one of the latest feeds that I've been given has colons in the name of the feed as seen in the example below:
<item>
<title>foo</title>
<description>foo</description>
<ccc:fid>10</ccc:fid>
<ccc:bid>6</ccc:bid>
</item>
When i try to create a $current->ccc:bid php does not get to happy (rightfully so). Is there any way to get around this?
the usage of ccc:fid is an extension of the namespace which needs to be declared in xml in order to be able to use it in libraries like simplexml.
Here are some examples of descriptions of usin a namespace:
Hope that helps, albeit it is a little complicated.