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/">nobody@flickr.com (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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.