for testing purposes I have removed the curl parts and used a manual string... here are my results
code:
Code: Select all
$doc = new DOMDocument();
if(!$doc->loadXML('<Table> <I>200</I> <Q>741</Q> <P>25.00</P> <C>25.00</C> </Table>')){
echo "doh!";
}
foreach ($doc->getElementsByTagName('Table') as $node) {
$ssi[$node->getElementsByTagName('I')->item(0)->nodeValue] = array (
'quantity' => $node->getElementsByTagName('Q')->item(0)->nodeValue,
'catalogPrice' => $node->getElementsByTagName('P')->item(0)->nodeValue,
'customerPrice' => $node->getElementsByTagName('C')->item(0)->nodeValue
);
}
print_r($ssi);
now if I change out the loadXML data like so:
Code: Select all
$doc->loadXML('<Table> <I>200</I> <Q>741</Q> <P>25.00</P> <C>25.00</C> </Table> <Table> <I>200</I> <Q>741</Q> <P>25.00</P> <C>25.00</C> </Table>')
This is my first time using DOMDocument so I must be missing something but I just cant work it out.
when using the actual returned XML data from the curl it returns absolutely nothing. the "doh!" error doesn't go off and print_r($ssi) returns nothing at all. I even echoed out the xml string I am using before the DOM script to besure it works and it does.
The XML data being recieved is structured as so:
Code: Select all
<NewDataSet>
<Table>
<I>11111</I>
<Q>741</Q>
<P>25.00</P>
<C>25.00</C>
</Table>
<Table>
<I>222222</I>
<Q>876</Q>
<P>12.00</P>
<C>12.00</C>
</Table>
</NewDataSet>