Jump to content

Problem With Getting Image Url From Rss Using Domdocument


hno

Recommended Posts

HI every one

i've rss reader that using DOMDocument .I just have a problem , I want to get image url from a feed but I couldn't use it . This is my code a xml example of this feed :

$doc = new DOMDocument();
$doc->load('http://feeds.gawker.com/lifehacker/full');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
print('<div style="width:100%" class="option"><strong>');
$a = $node->getElementsByTagName('title')->item(0)->nodeValue;
print("$a");
echo "<br /><br />";
$a = $node->getElementsByTagName('image')->item(0)->nodeValue;
print("$a");
}

 

This is a part of this feed :

<link>[url="http://lifehacker.com</link>"]http://lifehacker.com</link>[/url]
<description>Computers make us more productive. Yeah, right. Lifehacker recommends the software downloads and web sites that actually save time. Don't live to geek; geek to live.</description>
<language>en</language>
<pubDate>Tue, 16 Oct 2012 11:10:31 GMT</pubDate>
<lastBuildDate>Tue, 16 Oct 2012 11:10:31 GMT</lastBuildDate>
<ttl>2</ttl>
<image>
<title>Lifehacker</title>
<url>[url="http://ganja.gawkerassets.com/assets/base/img/thumbs140x140/lifehacker.com.png</url>"]http://ganja.gawkera...r.com.png</url>[/url]
<link>[url="http://lifehacker.com</link></image>"]http://lifehacker.co...</link></image>[/url]

How can I get the image url from it ?

Thanks

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.