PHP SimpleXML + Get Attribute

This should work.

$id = $xml["id"];

Your XML root becomes the root of the SimpleXML object; your code is calling a chid root by the name of ‘show’, which doesn’t exist.

You can also use this link for some tutorials: http://php.net/manual/en/simplexml.examples-basic.php

Leave a Comment