Hi All,

Im using PHP to extract data from an XML response.

for example:

<UserManageResult>
<ErrorNumber>0</ErrorNumber>
<ErrorMessage/>
<guid>a806368a64ab4cd3a4fef3572e0f2276</guid>
</UserManageResult>

i would use this code to get the guid value

$xml = new SimpleXMLElement($result);
$guid = $xml->guid;

Which works fine.

my question is, how do i extract the value of id from within Order from this response

<Orders TransactionStatus="success" AccountId="504158">
−
<Order Id="641756" Description="1 x 17420 Joseph Campau St" DateOrdered="08-Apr-2010">
−
<Pricing Currency="GBP">
<CurrencyPrice>8.70</CurrencyPrice>
<CurrencyPriceTax>1.30</CurrencyPriceTax>

any assistance would be appreciated.

Regards

ok,

I think my solution lies with regex.

if im looking for the number held in the ID <Order id="123456"> how can i use regex to get it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.