So in one of my recent projects I had to parse a Flickr feed and extract the image urls the code I came up with is as follows:
<?php /* Author: Samuel Haddad * SimpleXML Flicker Feed Parser */ //Feed URL in RSS Format $url ="http://api.flickr.com/services/feeds/photos_public.gne?lang=en-us&format=rss_200"; //FEED URL //Use simple XML to parse the feed $xml = simplexml_load_file($url); $items = $xml->xpath('/rss/channel/item'); foreach($items as $item){ $nsmedia = $item->children('http://search.yahoo.com/mrss/'); $img = $nsmedia->content->attributes(); echo $img; //URL of Image echo "<br/>"; } ?>
Of course my code did more then just extract the URL, but I will leave the rest up to the creative developers.
Hey! I know this is very old post but this script actually still works when others failed. But this fetch only large image. How I can find smaller one for thumb? End with _m.jpg.
I haven’t touched this in ever. I will take a peek later and get back to you.
Don’t worry about it anymore. I figured it out already by changing _b to _t.
Thank you for sharing your solution with us!