SoapClient olmadan soap yanıtı ayrıştırmak nasıl

0 Cevap php

Ben bir SOAP yanıtı ayrıştırmak çalışıyorum son birkaç gün geçirdim ama ben o iş için alınamıyor. Ben tüm "oproduct" nesneleri elde edebilmek istiyorum.

EDIT: Ben bunu kullanmak yerine bu şekilde yapıyorum ben multi_curl kullanarak paralel isteklerini yapmak gerekir, çünkü SOAP istemci inşa.

İşte benim kod:

$xml = simplexml_load_string($response);
$xml->registerXPathNamespace('soap-env', 'http://schemas.xmlsoap.org/soap/envelope/');
foreach ($xml->xpath('//oproduct') as $item)
{
  // do something
}

İşte yanıtı:

<soap-env:envelope xmlns:ns1="http://v3.core.com.productserve.com/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:body>
    <ns1:getproductlistresponse>
      <oproduct>
        <iid>113133802</iid>
        <icategoryid>270</icategoryid>
        <imerchantid>1547</imerchantid>
        <iadult>0</iadult>
        <sname>The Ashes / 5th Test - England v Australia - Day 1</sname>
        <sawdeeplink>http://www.awin1.com/pclick.php?p=113133802&amp;a=111402&amp;m=1547&amp;platform=cs</sawdeeplink>
        <sawthumburl>http://images.productserve.com/thumb/1547/113133802.jpg</sawthumburl>
        <fprice>119.99</fprice>
      </oproduct>
      <oproduct>
        <iid>113133791</iid>
        <icategoryid>270</icategoryid>
        <imerchantid>1547</imerchantid>
        <iadult>0</iadult>
        <sname>The Ashes / 1st Test - England v Australia - Day 1</sname>
        <sawdeeplink>http://www.awin1.com/pclick.php?p=113133791&amp;a=111402&amp;m=1547&amp;platform=cs</sawdeeplink>
        <sawthumburl>http://images.productserve.com/thumb/1547/113133791.jpg</sawthumburl>
        <fprice>69.99</fprice>
      </oproduct>
      <oproduct>
        <iid>51155349</iid>
        <icategoryid>428</icategoryid>
        <imerchantid>513</imerchantid>
        <iadult>0</iadult>
        <sname>Rapitest DTM 118 Damp Test Meter</sname>
        <sawdeeplink>http://www.awin1.com/pclick.php?p=51155349&amp;a=111402&amp;m=513&amp;platform=cs</sawdeeplink>
        <sawthumburl>http://images.productserve.com/thumb/513/51155349.jpg</sawthumburl>
        <fprice>18.35</fprice>
      </oproduct>
      <oproduct>
        <iid>187948</iid>
        <icategoryid>474</icategoryid>
        <imerchantid>496</imerchantid>
        <iadult>0</iadult>
        <sname>Rapitest Dm 10 Electrical Multimeter</sname>
        <sawdeeplink>http://www.awin1.com/pclick.php?p=187948&amp;a=111402&amp;m=496&amp;platform=cs</sawdeeplink>
        <sawthumburl>http://images.productserve.com/thumb/496/187948.jpg</sawthumburl>
        <fprice>26.71</fprice>
      </oproduct>
      <oproduct>
        <iid>51155353</iid>
        <icategoryid>428</icategoryid>
        <imerchantid>513</imerchantid>
        <iadult>0</iadult>
        <sname>Rapitest DM 10 Electrical Multimeter</sname>
        <sawdeeplink>http://www.awin1.com/pclick.php?p=51155353&amp;a=111402&amp;m=513&amp;platform=cs</sawdeeplink>
        <sawthumburl>http://images.productserve.com/thumb/513/51155353.jpg</sawthumburl>
        <fprice>22.7</fprice>
      </oproduct>
      <oproduct>
        <iid>49152850</iid>
        <icategoryid>474</icategoryid>
        <imerchantid>1366</imerchantid>
        <iadult>0</iadult>
        <sname>Testboy Profi LED Plus</sname>
        <sawdeeplink>http://www.awin1.com/pclick.php?p=49152850&amp;a=111402&amp;m=1366&amp;platform=cs</sawdeeplink>
        <sawthumburl>http://images.productserve.com/thumb/1366/49152850.jpg</sawthumburl>
        <fprice>44.99</fprice>
      </oproduct>
      <oproduct>
        <iid>51155350</iid>
        <icategoryid>428</icategoryid>
        <imerchantid>513</imerchantid>
        <iadult>0</iadult>
        <sname>Rapitest ETP 116 Electrical Test Probe</sname>
        <sawdeeplink>http://www.awin1.com/pclick.php?p=51155350&amp;a=111402&amp;m=513&amp;platform=cs</sawdeeplink>
        <sawthumburl>http://images.productserve.com/thumb/513/51155350.jpg</sawthumburl>
        <fprice>17.55</fprice>
      </oproduct>
      <oproduct>
        <iid>51155351</iid>
        <icategoryid>428</icategoryid>
        <imerchantid>513</imerchantid>
        <iadult>0</iadult>
        <sname>Rapitest ET 111 Electrical Test Meter</sname>
        <sawdeeplink>http://www.awin1.com/pclick.php?p=51155351&amp;a=111402&amp;m=513&amp;platform=cs</sawdeeplink>
        <sawthumburl>http://images.productserve.com/thumb/513/51155351.jpg</sawthumburl>
        <fprice>13.55</fprice>
      </oproduct>
      <oproduct>
        <iid>72326941</iid>
        <icategoryid>474</icategoryid>
        <imerchantid>496</imerchantid>
        <iadult>0</iadult>
        <sname>Rapitest Etp 116 Electrical Test Probe</sname>
        <sawdeeplink>http://www.awin1.com/pclick.php?p=72326941&amp;a=111402&amp;m=496&amp;platform=cs</sawdeeplink>
        <sawthumburl>http://images.productserve.com/thumb/496/72326941.jpg</sawthumburl>
        <fprice>20.66</fprice>
      </oproduct>
      <oproduct>
        <iid>49338340</iid>
        <icategoryid>206</icategoryid>
        <imerchantid>80</imerchantid>
        <iadult>0</iadult>
        <sname>Ladies Protest Zekke Jacket True Black</sname>
        <sawdeeplink>http://www.awin1.com/pclick.php?p=49338340&amp;a=111402&amp;m=80&amp;platform=cs</sawdeeplink>
        <sawthumburl>http://images.productserve.com/thumb/80/49338340.jpg</sawthumburl>
        <fprice>54.99</fprice>
      </oproduct>
      <itotalcount>6350</itotalcount>
    </ns1:getproductlistresponse>
  </soap-env:body>
</soap-env:envelope>

0 Cevap