Q:

Google Contacts API XML parsing with PHP

I have an xml feed from Google Contacts API, but I have trouble reading <gd: tags.
$xml = simplexml_load_string($google_contacts);

This reads every elements except the <gd: tags, which contains e-mail information.
What's the best thing to do?

A:

Update: If you're using name-spaces and xpath, you might need to register them first in SimpleXML.
If you have problems to access an element, try to enclose it within {} angel brackets, this probably helps: $xml->{gd:...}.

SimpleXML has no/limited support for XML-Namespaces if I remember correctly. DomDocument has, so take it instead.
For a first start:
$dom = new DomDocument;
$dom->loadXML($google_contacts);
...

Or use DomDocument for the part that is difficult to do in SimpleXML only:
$domElement = dom_import_simplexml($simpleXmlNode);

