User325313 User325313 - 10 months ago 71
PHP Question

Can't extract rss feed item title

I'm using a php code to extract the title of an ebay affiliate (Partner Network) rss, but I'm having no success. What am I doing wrong?
By the way, is it possible to link the title too?


$xml = new DOMDocument();

$products = array();

//Loop through each <td> tag in the dom and extract inner html

foreach($xml->getElementsByTagName('td') as $p) {
$children = $p->childNodes;
$phtml = '';
foreach ($children as $child)
$phtml.= $p->ownerDocument->saveHTML($child);

echo '<div id="mainproductafilioright1"><div class="product">' . $phtml . '</div></div>';


You're on the right way. While checking the feed page I could see that the td elements are inside the <![CDATA[. but the title is outside it, that's why you can't get the title.

Try this temporary solution (This is a completely new code, not to be inserted with the older one):

$feedurl = "";

$rss = simplexml_load_file($feedurl);

foreach ($rss->channel->item as $item) {

$link = $item->link;

$title = $item->title;

$description = $item->description;


You can output it using print:

print = $description;