View Full Version : Shopping.com PHP Script is skipping groups...why?

12-06-2008, 06:05 PM
I have a PHP code that is as follows...

@ini_set(‘display_errors’, 0);
$product_specs_xml = new product_specs_xml;


class product_specs_xml
function readXML($productId)
$this->xml = file_get_contents("http://publisher.api.shopping.com/publisher/3.0/rest/GeneralSearch?apiKey=REMOVED&trackingId=REMOVED&productId=$productId&showProductSpecs=true&numItems=0");
$groups = $this->parse_tags('featureGroup',$this->xml);
foreach($groups as $g)
$featureGroups["$featurename[1]"] = array();
foreach($feature[1] as $f)
$featureGroups["$featurename[1]"]["$name[1]"] = $value['1'];
foreach($featureGroups as $group => $features)
$this->rows .= "<thead>
<th colspan=\"2\">$group</th>
foreach($featureGroups[$group] as $name => $value)
$this->rows .= "<tr><td>$name</td><td>$value</td></tr>";

function parse_tags($tag,$src)
return $matches['1'];

function output()
echo '<div class="testReportChart">
<table class="testReportTable">';
echo $this->rows;
echo '</table>

and it uses an XML script like this http://sandbox.api.shopping.com/publisher/3.0/rest/GeneralSearch?apiKey=authorized-key&trackingId=7000610&productId=45041151&showProductSpecs=true&numItems=0 but when it displays the <featureGroup> information in that tag, it shows the first one, then skips the second one, then shows the third one, then skips the 4th...and so on.

With that particular link to that XML file, it shows the ProductMPN, Audio Capabilities, Screen, Other Features, and Dimensions <featureGroup>'s, but it skips the ones inbetween.

Why does this happen and how do I fix it? Thanks.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum