Possible Duplicate:
PHP namespace simplexml problems
I have a portion of xml as :
<item>
<source url="eurosport.com">Eurosport</source>
<media:content url="http://media.zenfs.com/en_GB/Sports/Eurosport/900589-15042881-640-360.jpg" type="image/jpeg" width="130" height="86" />
</item>
I am using the SimpleXMLElement() to convert the textual xml data into a SimpleXML Element Object. By that I can has access to item
as $item
.
I am required to obtain the url
of media:content
and am not able to do it. Can anyone help me out?
P.S: Tried this, but it did not help ..
foreach ($item->{'media:content'}->attributes() as $key => $val) {
return (string)$val;
}