I'm using PHP and CURL to get XML, but I'm having problems accessing a specific type of attributes.
Say the XML document is like this:
<item>
<title>Example Title</title>
<link>http://www.google.com</link>
<description>Sample desc here.</description>
<media:content xmlns:media="http://mediaurl.com/" url="http://www.exampleurl.com/"
type="image/jpeg" medium="image" height="226" width="571">
</media:content>
</item>
I want to access the url attribute within the tag, but can't seem to get around the namespace problem.
Currently, I've tried using:
$promos = $item->getElementByTagNameNS("media", "content");
foreach ($promos as $promo)
{
$promoImage = $promo->getAttribute("url");
break;
}
echo $promoImage;