Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

issues with simplexml_load_string/SimpleXMLElement on PHP 5.1/Linux

crmpiccocrmpicco Posts: 12Member
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

[code]
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;

}
[/code]
Sign In or Register to comment.