How do I loop through this xml and get the attribute href
of the second <link>
tag? The one with the attribute rel="enclosure"
This is the XML;
<entry>
<link rel="alternate" type="text/html" href="http://www.flickr.com/photos/dax/5495234222/in/set-756787626064123145/"/>
<link rel="enclosure" type="image/jpeg" href="http://farm6.staticflickr.com/5012/5485746322_9821c561bf_b.jpg" />
</entry>
This is the php script so far:
<?php
foreach ($feed->entry as $item) {
$photo = $item->link['href'];
?>
<div class="">
<a href="<?php print $photo; ?>" class="colorbox-load"><img class="img-responsive" src="<?php print $photo; ?>"></a>
</div>
<?php
}
?>
This is working apart form the fact it prints the href
of the first <link>
which is not the one I need.