How to read/display XML using PHP

javascript, php, xml

Solution

The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators.

https://www.php.net/manual/en/simplexml.examples-basic.php

Problem

Is there a way to read off from an [external] xml (an xml file from a different website) using PHP? I know there's a way to read XML using JavaScript, but only if they are both in the same root. Could you provide an example on how to source the xml file, then read the following: ``` <parent> <child> <grandchild>Example Text 1</grandchild> </child> <child> <grandchild>Example Text 2</grandchild> </child> </parent> ``` Thanks!

Original source