Skip to content
Advertisement

How can I get an XML attribute as below using file_get_contents or simplexml_load_file?

How can I get the firstname of the XML below?

I am trying to use file_get_contents or simplexml_load_file and trying to echo the value like

$html->result[0]->contact;

without any luck. Can I have some help please?

enter image description here

Advertisement

Answer

I don’t see full xml but I suppose it is:

$html->entities[0]->organization[0]->description;
$html->entities[0]->organization[0]->contacts[0]->contactPerson['firstName'];
2 People found this is helpful
Advertisement