read complelx soap response in php

Solutions on MaxInterview for read complelx soap response in php by the best coders in the world

showing results for - "read complelx soap response in php"
Steven
13 Nov 2017
1$soap = <<< LOL
2<?xml version="1.0" encoding="UTF-8"?>
3<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
4    <SOAP-ENV:Header />
5    <SOAP-ENV:Body>
6        <ns3:GetDistrictByAddressResponse xmlns:ns3="http://il/co/bar/webservices/getdistrictbyaddress">
7            <TimeFrameTable>
8                <CustomerNumber>250</CustomerNumber>
9                <Row>
10                    <WindowDate>10052016</WindowDate>
11                    <WeekDay>Sunday</WeekDay>
12                    <FromHour>1130</FromHour>
13                    <ToHour>1430</ToHour>
14                </Row>
15                <Row>
16                    <WindowDate>10052016</WindowDate>
17                    <WeekDay>Sunday</WeekDay>
18                    <FromHour>1430</FromHour>
19                    <ToHour>1730</ToHour>
20                </Row>
21            </TimeFrameTable>
22        </ns3:GetDistrictByAddressResponse>
23    </SOAP-ENV:Body>
24</SOAP-ENV:Envelope>
25LOL;
26$xml = simplexml_load_string($soap);
27foreach ($xml->xpath('//Row') as $item)
28{
29    print_r($item);
30}
31
32
33Output:
34
35SimpleXMLElement Object
36(
37    [WindowDate] => 10052016
38    [WeekDay] => Sunday
39    [FromHour] => 1130
40    [ToHour] => 1430
41)
42SimpleXMLElement Object
43(
44    [WindowDate] => 10052016
45    [WeekDay] => Sunday
46    [FromHour] => 1430
47    [ToHour] => 1730
48)