Skip to content
Advertisement

XML file with different elements

Hello i have this xml file

JavaScript

and i need to get data from element <are:ICO> with php, i tried this, but that shows me error, because of that “are:” i think, it shows me this error

“Parse error: syntax error, unexpected token “:” in C:xampphtdocsxmldata.php on line 4″

JavaScript

Advertisement

Answer

Since you are dealing with xml and namespaces, you should parse the data with an xml parser and, using xpath, properly handle the namespaces. Something like:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement