$xml
is a SimpleXML
object.
print_r($xml->Title);
outputs SimpleXMLElement Object ( [0] => K&H 3093 Extreme Weather Kitty Pad with Fleece Cover )
How do I access the first element?
print_r($xml->Title[0]);
outputs nothing!
SimpleXML is a PHP extension that allows users to easily manipulate/use XML data. It was introduced in PHP 5 as an object oriented approach to the XML DOM providing an object that can be processed with normal property selectors and array iterators.
SimpleXML is an extension that allows us to easily manipulate and get XML data. SimpleXML provides an easy way of getting an element's name, attributes and textual content if you know the XML document's structure or layout.
The SimpleXMLElement::attributes() function is an inbuilt function in PHP which is used to retrieve the attributes and its value from an XML tag in a SimpleXML object.
Try
echo (string) $xml->Title;
You have to cast it as a string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With