Jump to content

Parse XML


ldoozer

Recommended Posts

Can any one tell me how to access the image of this xml file:

<item>
            <title>DSC00083</title>
            <link>http://www.flickr.com/photos/53764782@N08/4963929579/</link>
            <description><p><a href="http://www.flickr.com/people/53764782@N08/">SteveDupree</a> posted a photo:</p>
                
                
                <p><a href="http://www.flickr.com/photos/53764782@N08/4963929579/" title="DSC00083"><img src="http://farm5.static.flickr.com/4111/4963929579_3334de3f06_m.jpg" width="240" height="180" alt="DSC00083" /></a></p></description>
            <pubDate>Mon, 06 Sep 2010 10:05:37 -0700</pubDate>
            <dc:date.Taken>2007-08-08T19:30:20-08:00</dc:date.Taken>
            <author flickr:profile="http://www.flickr.com/people/53764782@N08/">[email protected] (SteveDupree)</author>
            <guid isPermaLink="false">tag:flickr.com,2004:/photo/4963929579</guid>
            <media:content url="http://farm5.static.flickr.com/4111/4963929579_cf0b5e5656_o.jpg" 
                   type="image/jpeg"
                   height="1224"
                   width="1632"/>
            <media:title>DSC00083</media:title>
            <media:thumbnail url="http://farm5.static.flickr.com/4111/4963929579_3334de3f06_s.jpg" height="75" width="75" />
            <media:credit role="photographer">SteveDupree</media:credit>
        </item>

 

I am retereiving the title and the href with this:

//print_r ($rss);
echo '<ul>';
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
$img = $item['?????????'];
echo "<li><a href=$href>" . $img . "</a></li>";
}
echo "</ul>";
?>

 

but cant seem to get at

<media:content url="http://farm5.static.flickr.com/4111/4963929579_cf0b5e5656_o.jpg" 
                   type="image/jpeg"
                   height="1224"
                   width="1632"/>

Link to comment
https://forums.phpfreaks.com/topic/213921-parse-xml/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.