in the description tag of a feed, there are some images. i want to get their sources and save in a database.
suppose this is the description tag:
-<description> some text ... <img src="http://www.sth.com/image1.jpg"> .. some text ... <img src="http://www.sth.com/image2.jpg">
</description>
the description tag has been achived by this piece of code which i have no problem about it.
$tnl = $item->getElementsByTagName("description");
$tnl = $tnl->item(0);
if(isset($tnl->firstChild->data))
$description = $tnl->firstChild->data;
I wrote the code below to get the IMG tag:
$tnl = $description ->getElementsByTagName("img");
$tnl = $tnl->item(0);
echo $image = $tnl->attributes->getNamedItem('src')->value;
but in the first line of the code above, an error is announced:
Fatal error: Call to a member function getElementsByTagName() on a non-object in /home/rsslibtest.php on line 63
how can i get images?
thanks.