php read xml file code example
Example 1: php read xml from url
$xml=simplexml_load_file("filename.xml") or die("Error: Cannot create object");
echo $xml->detaildata->lattitude;
echo $xml->detaildata->longitude;
Example 2: php read xml from url
$xml=simplexml_load_file("filename.xml") or die("Error: Cannot create object");
echo $xml->detaildata->lattitude;
echo $xml->detaildata->lattitude->__toString();
Example 3: read xml file in php wordpress
$xml = simplexml_load_file('big_xml_file.xml');
foreach ($xml->element as $el) {
echo $el->name;
}