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" 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?
Code:
SimpleXMLElement Object
(
[@attributes] => Array
(
[Id] => 1
)
[LineNumber] => 1
[TaxSummary] => SimpleXMLElement Object
(
[EffectTaxRate] => 0.09752
[TaxAmount] => 24.38
[TaxBasis] => 250.00
)
)
PHP Code:
$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;
}
Any help would be really appreciated. Have been looking at this for ages now!
Cheers,
Picco