[text]
<item>
<couponid>16130394</couponid>
<link>http://www.coupons.com/alink.asp?go=139 ... =yes</link>
<description>$0.75 off Kraft 2% Milk Cheese Singles</description>
<image>http://cdn.coupons.com/insight.coupons. ... gif</image>
<activedate>4/1/2011</activedate>
<shutoff>6/30/2011 11:59:00 PM</shutoff>
<expiration>6/30/2011 11:59:00 PM</expiration>
<majorCategory>Foods</majorCategory>
<minorCategory>Cheese</minorCategory>
<brand>KRAFT Singles</brand>
<value>0.75</value>
<geotarget>0</geotarget>
</item>
[/text]
My code is like this:
Code: Select all
<table width="100%" border="0">
<?php
$doc = new DOMDocument();
$doc->load('http://rss.coupons.com/xmlserve.asp?go=13903xh2010&bid=136610001');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
$itemRSS = array (
'val' => $node->getElementsByTagName('value')->item(0)->nodeValue,
'image' => $node->getElementsByTagName('image')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'exp' => $node->getElementsByTagName('expiration')->item(0)->nodeValue
);
array_push($arrFeeds, $itemRSS);
$expdate = explode(" ", $itemRSS["exp"]);
echo "<tr>";
echo "<td>";
echo "<a href=\"".$itemRSS["link"]."\" class=\"print-title\" target=\"_blank\">";
echo "<img align=\"left\" src=\"".$itemRSS["image"]."\" width=\"50\" hspace=\"10\">";
echo $itemRSS["desc"];
echo "<br> Expire: ";
echo $expdate[0];
echo "</a>";
echo "</td>";
echo "</tr>";
}
?>
</table>
I have looked at many examples for days and could not figure out how. Can it be sorted with a simple PHP built-in function?
Thank you for your help!
Becky