how to access this child element - attribute in php simplexml

AXMelaCalisip

New Member
I want to access the 'url' attribute in the media:content element below. I am pretty sure this gives me the media:content, but I can not seem to get the url (see what I tried below):\[code\]$theContent = $item->children('media', true)->content;\[/code\]xml:\[code\]<item><media:content type="image/jpeg" url="my url" /></item>\[/code\]I have tried variations:\[code\] $theURL = $item->children('media', true)->content['url'];\[/code\]and\[code\]$mediaItem=$item->children('media', true)->content;$contentItem=$mediaItem->children('content', true);$url = $contentItem['url'];\[/code\]No luck. ??
 
Back
Top