I'm trying to get content from an XML document using PHP.
This is my current code to get regular XML elements (title and URL).
$xml = simplexml_load_file("courses.xml") or die("Error: Cannot create object");
$i = 0;
do {
echo $xml->channel->item[$i]->title.", <a href='";
echo $xml->channel->item[$i]->guid."'>URL</a><br>";
$i = $i + 1;
} while ($i < 47);
Now, in the XML document there's this kind of element:
<course:image-thumbnail>https://www.edx.org/image.png</course:image-thumbnail>
I tried calling the content of this element using PHP the same way I called the previous elements, but it does not seem to work because of the presencey of the colon : .
How can I make this work?
I've started on PHP and XML only 2 days ago, so it's all really new for me.
Thanks for your help.