LJackson
04-18-2010, 10:21 PM
Hi All,
here is a snippet of an xml file i have
<merchantProductFeed>
−
<merchant id="1418">
−
<prod id="9887290">
<pId>91625</pId>
−
<text>
<name>A River Runs Through It</name>
</text>
−
<uri>
−
<awTrack>
http://www.awin1.com/pclick.php?p=9887290&a=79524&m=1418
</awTrack>
−
<awImage>
http://images.productserve.com/preview/1418/9887290.jpg
</awImage>
</uri>
−
<price>
<store>0.00</store>
<rrp>9.99</rrp>
<delivery>0.00</delivery>
</price>
<cat/>
<brand/>
</prod>
and i am just trying to get the product id and name and display it, for now but i cant seem to do it :(
here is my code
// xml file in the same directory as this file -
$feed_url = "http://www.kernow-connect.com/feedtest/dvdfeed.xml";
// Load XML.
$xml=simplexml_load_file($feed_url);
// How many items to display from the RSS Feed ...
$count = 5;
foreach ($xml->merchantProductFeed->merchant as $item)
{
if($count > 0)
{
echo"
$item->prod->id<br />
$item->prod->text->name<br />
<br />";
}
$count--;
}
any ideas where ive gone wrong?
thanks
here is a snippet of an xml file i have
<merchantProductFeed>
−
<merchant id="1418">
−
<prod id="9887290">
<pId>91625</pId>
−
<text>
<name>A River Runs Through It</name>
</text>
−
<uri>
−
<awTrack>
http://www.awin1.com/pclick.php?p=9887290&a=79524&m=1418
</awTrack>
−
<awImage>
http://images.productserve.com/preview/1418/9887290.jpg
</awImage>
</uri>
−
<price>
<store>0.00</store>
<rrp>9.99</rrp>
<delivery>0.00</delivery>
</price>
<cat/>
<brand/>
</prod>
and i am just trying to get the product id and name and display it, for now but i cant seem to do it :(
here is my code
// xml file in the same directory as this file -
$feed_url = "http://www.kernow-connect.com/feedtest/dvdfeed.xml";
// Load XML.
$xml=simplexml_load_file($feed_url);
// How many items to display from the RSS Feed ...
$count = 5;
foreach ($xml->merchantProductFeed->merchant as $item)
{
if($count > 0)
{
echo"
$item->prod->id<br />
$item->prod->text->name<br />
<br />";
}
$count--;
}
any ideas where ive gone wrong?
thanks