southbeach
Programmer
Working on a script to fetch info from a service provider - All is well as far as getting to the provider, sending what needs to be sent ...
My confusion rises when I try to pare the returned XML object:
The complete XML object is captured in PHP variable $xml - the above show the top portion of the object obtained by using var_dump().
Now, if I use:
I can echo both variables and get expected content.
If I do
and echo $total, it tells me it is an object.
I have been looking at this for a while but cannot see how totalCharge is defined as an object.
I then use var_dump() to show $total and I get
object(SimpleXMLElement)#3 (1) { [0]=> string(7) "1734.54" }
Worst thing is that $total[0] nor $total->0 can be referenced.
What am I missing here?
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
My confusion rises when I try to pare the returned XML object:
Code:
object(SimpleXMLElement)#2 (22) {
["@attributes"]=>
array(1) {
["Version"]=>
string(6) "160126"
}
["errMsg"]=>
object(SimpleXMLElement)#5 (0) {
}
["RateQuoteNumber"]=>
string(12) "201610036706"
["EffectiveDate"]=>
string(10) "10/03/2016"
["shippingDays"]=>
string(1) "2"
["destinationServiceCenter"]=>
string(9) "ALBANY NY"
["originatingServiceCenter"]=>
string(15) "WEST CHESTER PA"
["totalCharge"]=>
string(7) "1734.54"
["ClassRates"]=>
object(SimpleXMLElement)#6 (1) {
["Class"]=>
string(5) "57.34"
}
["RateAsWeight"]=>
string(4) "2500"
["DeficitCharges"]=>
object(SimpleXMLElement)#7 (0) {
}
["FreightCharge"]=>
string(6) "1433.5"
["FuelSurcharge"]=>
string(6) "301.04"
["FerryCharge"]=>
object(SimpleXMLElement)#8 (0) {
}
...
...
...
Now, if I use:
Code:
$err=$xml->Msg;
$qNo=$xml->RateQuoteNumber;
If I do
Code:
$total=$xml->totalCharge;
I have been looking at this for a while but cannot see how totalCharge is defined as an object.
I then use var_dump() to show $total and I get
object(SimpleXMLElement)#3 (1) { [0]=> string(7) "1734.54" }
Worst thing is that $total[0] nor $total->0 can be referenced.
What am I missing here?
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.