我想轉換soap xml響應並將其存儲在數據庫中。這是我擁有的XML。PHP - 將XML轉換爲PHP中的數組 - 在php中解析soap xml並將其存儲在數據庫中
<ENV:Envelope xmlns:ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://example.com/soap/example">
<ENV:Body>
<ns1:GetCentresResponse>
<ExampleCentre>
<ns1:Cent>
<ID>200</ID>
<Name>example2</Name>
<Code>ex2</Code>
<Email>[email protected]</Email>
<Address1>example2, example2 </Address1>
<Address2>example2, example2 </Address2>
<City>example2</City>
<PostCode>111111</PostCode>
<Telephone>1111111111</Telephone>
<Location>11.11,-11.11</Location>
<URL>/example2/exam2/ex2</URL>
</ns1:Cent>
</ExampleCentre>
</ns1:GetCentresResponse>
</ENV:Body>
</ENV:Envelope>
我從服務器得到這個肥皂響應。我想將其轉換爲數組並將其存儲在數據庫中。我該怎麼辦?我知道答案可能很直接,但嘿,是一個新手:D
真的很感激我得到的任何幫助。
謝謝您的期待。
問候
您可能想要提一下,SOAP調用的返回值將包含一個對象,該對象的成員與該XML文件相匹配。 –
感謝這個,不知道這個類:) –
嗨Lhunar,謝謝你的迴應。它的工作:) – BasicGem