Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 10th, 2009, 12:33 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Thumbs down issues with simplexml_load_string/SimpleXMLElement on PHP 5.1/Linux

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
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing on Linux PHP Kevin Tough BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 December 5th, 2006 07:01 PM
PHP and MSSQL on Linux rvanandel PHP Databases 1 November 15th, 2005 08:55 PM
Install php on linux Archos Beginning PHP 1 March 29th, 2004 08:08 AM
php on linux vikaspuri PHP How-To 0 March 1st, 2004 02:31 PM
problem with PHP - MYSQL in LINUX cnilashis PHP How-To 3 August 18th, 2003 02:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.