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?
PHP
<?php
$xml = new DOMDocument();
@$xml->loadHTMLFile('http://rest.ebay.com/epn/v1/find/item.rss?keyword=%28jewelry%2Ccraft%2Cclothing%2Cshoes%2Cdiy%29&sortOrder=BestMatch&programid=1&campaignid=5337945426&toolid=10039&listingType1=All&lgeo=1&topRatedSeller=true&hideDuplicateItems=true&entriesPerPage=2&feedType=rss');
$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>';
}
?>
2
Answers
Would comment but not enough rep.
There are no td elements in that feed. It’s also not an HTML file.
Instead:
Here’s how I’d do it:
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):
You can output it using
print
:print = $description;