This works fine under WAMP with PHP 5.3 and Windows XP on my dev machine. But on a Unix/PHP 5.1 env it doesn't. I am looking to pull out "LineNumber" and "TaxAmount" from the XML for each iteration of the loop below, for each iteration "$tax_line" is always an object of simplexml_load_string ( http://us2.php.net/manual/en/functio...oad-string.php ).
$tax_line is the following object, which obviously has a type of "object".
Does anyone know how I would do this?
The point where things seem to get screwy between Windows and Linux is when I come to this line: $tax_lines = $tax_document->TaxLines->TaxLine;
The SimpleXMLElement is a print_r dump of "$tax_line".
Any help would be really appreciated. Have been looking at this for ages now!
Cheers,
Picco
SimpleXMLElement Object
(
[@attributes] => Array
(
[Id] => 1
)
[LineNumber] => 1
[TaxSummary] => SimpleXMLElement Object
(
[EffectTaxRate] => 0.09752
[TaxAmount] => 24.38
[TaxBasis] => 250.00
)
)
$response_xml = simplexml_load_string($data);
$document_status = $tax_document->DocumentStatus->Success; // this can be outputted fine
$tax_lines = $tax_document->TaxLines->TaxLine;
foreach ($tax_lines as $tax_line) {
$linenumber = (string) $tax_line[0]->LineNumber;
$taxamount = (string) $tax_line[0]->TaxSummary->TaxAmount;
}