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

Edited by hno
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.