XML array into PHP

I am using a soap request to return some information from our ERP system. This returns an XML array of results which is great.

I need to be able to put these results (or some of them) into a MYSQL database. So I presume I need to read this XML array into a PHP array so I can enter the details into the database.

Is simplexml the answer to this?

I’m having trouble locating the terminology I need to use to search for help on.

Many thanks

As a followup here is the XML I get:

<SOAP-ENV:Envelope>
<SOAP-ENV:Body SOAP-ENC:encodingStyle="http://schemas.xmlsoap.org/soap/envelope/">
<NS1:GetProductResponse>
<return href="#1"/>
</NS1:GetProductResponse>
<NS2:TProduct id="1" xsi:type="NS2:TProduct">
<Code xsi:type="xsd:string">11223344</Code>
<Description xsi:type="xsd:string">Product description goes here</Description>
<Category xsi:type="xsd:string">CH03</Category>
<Status xsi:type="xsd:string">A</Status>
<Stock xsi:type="xsd:double">274</Stock>
<OnOrder xsi:type="xsd:double">0</OnOrder>
<Reserved xsi:type="xsd:double">12</Reserved>
<SellingUnits xsi:type="xsd:string">PAIR</SellingUnits>
<PurchaseUnits xsi:type="xsd:string">PAIR</PurchaseUnits>
<Conversion xsi:type="xsd:double">1</Conversion>
<Price xsi:type="xsd:double">23.87</Price>
<GrossPrice xsi:type="xsd:double">28.644</GrossPrice>
<SizeCode xsi:type="xsd:string"/>
<Available xsi:type="xsd:double">262</Available>
<LocationCode xsi:type="xsd:string">01</LocationCode>
<BinLoc xsi:type="xsd:string"/>
<AltCode xsi:type="xsd:string"/>
<AltDescription xsi:type="xsd:string"/>
<ItemType xsi:type="xsd:string">F</ItemType>
<TileSqm xsi:type="xsd:double">0</TileSqm>
<TileQtyCtn xsi:type="xsd:double">0</TileQtyCtn>
<CartonPalet xsi:type="xsd:double">0</CartonPalet>
<SqmPalet xsi:type="xsd:double">0</SqmPalet>
<TileSqmCtn xsi:type="xsd:double">0</TileSqmCtn>
<SelMsg xsi:type="xsd:string"/>
<PoSelMsg xsi:type="xsd:string"/>
<BarCodes xsi:type="xsd:string">5052029102642|1234567891234|987654321025|</BarCodes>
<DefaultQuantity xsi:type="xsd:double">0</DefaultQuantity>
<Make xsi:type="xsd:string"/>
<Model xsi:type="xsd:string"/>
<CostPrice xsi:type="xsd:double">0</CostPrice>
<Exdetail1 xsi:type="xsd:string">more desc</Exdetail1>
<Exdetail2 xsi:type="xsd:string"/>
<Dept xsi:type="xsd:string"/>
<Selling1 xsi:type="xsd:double">23.87</Selling1>
<Selling2 xsi:type="xsd:double">23.87</Selling2>
<Selling3 xsi:type="xsd:double">23.87</Selling3>
<Selling4 xsi:type="xsd:double">23.87</Selling4>
<Selling5 xsi:type="xsd:double">23.87</Selling5>
<Selling6 xsi:type="xsd:double">23.87</Selling6>
<Selling7 xsi:type="xsd:double">23.87</Selling7>
<Selling8 xsi:type="xsd:double">23.87</Selling8>
<Selling9 xsi:type="xsd:double">11.95</Selling9>
<RetPrice xsi:type="xsd:double">28.64</RetPrice>
<RetSPrice xsi:type="xsd:double">0</RetSPrice>
<UDFS xsi:type="xsd:string">XXABOVEEOQ~1.00|XXBOXQTY~1.00|XXDISCTAB~358|XXEOQ~560.00|XXHAZCHEM~1|XXLASTUSEX~|XXMANPO~0|XXMARGIN~|XXMAXPOQTY~6.00|XXMINPOQTY~6.00|XXNEWCAT~CHRS06|XXNEWCLASS~CH|XXNEWGROUP~CHRS|XXSTOCKED~1|XXSTPBOOK~1|</UDFS>
<NetMass xsi:type="xsd:double">0</NetMass>
<GrossMass xsi:type="xsd:double">0</GrossMass>
<DefVatCode xsi:type="xsd:string">1</DefVatCode>
<DefNomCode xsi:type="xsd:string">10150</DefNomCode>
</NS2:TIntactProduct>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I have 27000 products to pull out of the ERP :slight_smile: