I am trying to parse the namespace Rate
under the QuoteDetail
section. Here is my response from the web service. Any help on getting that Rate
node extracted would be awesome.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<RateQuoteByAccountResponse xmlns="https://webservices.rrts.com/ratequote/">
<RateQuoteByAccountResult>
<QuoteNumber>2066833</QuoteNumber>
<NetCharge>676.75</NetCharge>
<Customer>
<AccountNumber>*******</AccountNumber>
<Name>*****</Name>
<Address1>**</Address1>
<Address2>**</Address2>
<City>***</City>
<State>**</State>
<ZipCode>*****</ZipCode>
</Customer>
<RoutingInfo>
<DestinationState>CA</DestinationState>
<DestinationZip>90210</DestinationZip>
<OriginState>NC</OriginState>
<OriginZip>27360</OriginZip>
<EstimatedTransitDays>5</EstimatedTransitDays>
<OriginTerminal>Charlotte</OriginTerminal>
</RoutingInfo>
<RateDetails>
<QuoteDetail>
<ActualClass>60</ActualClass>
<RatedClass>60</RatedClass>
<Charge>533.45</Charge>
<Code></Code>
<Description></Description>
<Rate>106.69</Rate>
<Weight>500</Weight>
</QuoteDetail>
<QuoteDetail>
<ActualClass></ActualClass>
<RatedClass></RatedClass>
<Charge>41.95</Charge>
<Code>ID</Code>
<Description>Inside Delivery</Description>
<Rate>0</Rate>
<Weight></Weight>
</QuoteDetail>
<QuoteDetail>
<ActualClass></ActualClass>
<RatedClass></RatedClass>
<Charge>32</Charge>
<Code>CFP</Code>
<Description>Prepaid COD Fee</Description>
<Rate>0</Rate>
<Weight></Weight>
</QuoteDetail>
<QuoteDetail>
<ActualClass></ActualClass>
<RatedClass></RatedClass>
<Charge>69.35</Charge>
<Code>FSC</Code>
<Description>Fuel Surcharge - 13.00 %</Description>
<Rate>0</Rate>
<Weight></Weight>
</QuoteDetail>
</RateDetails>
<OriginType>O</OriginType>
<PaymentType>P</PaymentType>
<CODAmount>0</CODAmount>
<ShipmentDate>2105-08-07T00:00:00</ShipmentDate>
<CustomerCubicFoot>0</CustomerCubicFoot>
<HawaiianRatedCubicFoot>0</HawaiianRatedCubicFoot>
</RateQuoteByAccountResult>
</RateQuoteByAccountResponse>
</soap:Body>
</soap:Envelope>
This is the code I am using to try and parse but getting error: Call to a member function children() on string
$xml = $curl->response;
$rate = (string)$xml->children('soap', true)->Body->RateQuoteByAccountResponse->RateQuoteByAccountResult->RateDetails->QuoteDetail->Rate;