Hello, how can you help me with this, I am consuming a webservice but I have doubts about how to read it, I don't know what type it is or there are several types of webservices.
$url = file_get_contents("https://webservice.com/consulta=11111111&out=json");
$prueba = json_decode($url,true);
$dato = $prueba['list']['multiRef']['ddp_nombre'];
print_r($dato);
So far I have managed to read the array that is printed: Array ( [@type] => xsd:string [$] => MI CASA ES BONITA SAC )
But not managed to get to: MY HOUSE IS BEAUTIFUL SAC
I need your help.
THIS IS THE FULL XML ABOVE I CONVERTED IT TO JSON
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getDatosPrincipalesResponse xmlns:ns1="http://service.consultaruc.registro.servicio2.sunat.gob.pe" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<getDatosPrincipalesReturn href="#id0"/>
</ns1:getDatosPrincipalesResponse>
<multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:ConsultaRuc" id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:BeanDdp">
<cod_dep xsi:type="xsd:string">15</cod_dep>
<cod_dist xsi:type="xsd:string">150122</cod_dist>
<cod_prov xsi:type="xsd:string">1501</cod_prov>
<ddp_ciiu xsi:type="xsd:string">72202</ddp_ciiu>
<ddp_doble xsi:type="xsd:string" xsi:nil="true"/>
<ddp_estado xsi:type="xsd:string">11</ddp_estado>
<ddp_fecact xsi:type="xsd:string">03/12/2016</ddp_fecact>
<ddp_fecalt xsi:type="xsd:string">20/06/2015</ddp_fecalt>
<ddp_fecbaj xsi:type="xsd:string">30/11/2016</ddp_fecbaj>
<ddp_flag22 xsi:type="xsd:string">00</ddp_flag22>
<ddp_identi xsi:type="xsd:string">02</ddp_identi>
<ddp_inter1 xsi:type="xsd:string">-</ddp_inter1>
<ddp_lllttt xsi:type="xsd:string">-</ddp_lllttt>
<ddp_mclase xsi:type="xsd:string" xsi:nil="true"/>
<ddp_nombre xsi:type="xsd:string">KNOWLEDGE MANAGEMENT CONSULTING S.A.C.</ddp_nombre>
<ddp_nomvia xsi:type="xsd:string">BUENOS AIRES</ddp_nomvia>
<ddp_nomzon xsi:type="xsd:string">-</ddp_nomzon>
<ddp_numer1 xsi:type="xsd:string">125</ddp_numer1>
<ddp_numreg xsi:type="xsd:string">0023</ddp_numreg>
<ddp_numruc xsi:type="xsd:string">20543751589</ddp_numruc>
<ddp_reacti xsi:type="xsd:string" xsi:nil="true"/>
<ddp_refer1 xsi:type="xsd:string">ALT DE 1RA CDRA DE JOSÉ GONZALES</ddp_refer1>
<ddp_secuen xsi:type="xsd:int">0</ddp_secuen>
<ddp_tamano xsi:type="xsd:string" xsi:nil="true"/>
<ddp_tipvia xsi:type="xsd:string">03</ddp_tipvia>
<ddp_tipzon xsi:type="xsd:string">-</ddp_tipzon>
<ddp_tpoemp xsi:type="xsd:string">39</ddp_tpoemp>
<ddp_ubigeo xsi:type="xsd:string">150122</ddp_ubigeo>
<ddp_userna xsi:type="xsd:string" xsi:nil="true"/>
<desc_ciiu xsi:type="xsd:string">CONSULTORES PROG. Y SUMIN. INFORMATIC.</desc_ciiu>
<desc_dep xsi:type="xsd:string">LIMA</desc_dep>
<desc_dist xsi:type="xsd:string">MIRAFLORES</desc_dist>
<desc_estado xsi:type="xsd:string">BAJA DE OFICIO</desc_estado>
<desc_flag22 xsi:type="xsd:string">HABIDO</desc_flag22>
<desc_identi xsi:type="xsd:string">PERSONA JURIDICA</desc_identi>
<desc_numreg xsi:type="xsd:string">INTENDENCIA LIMA</desc_numreg>
<desc_prov xsi:type="xsd:string">LIMA</desc_prov>
<desc_tamano xsi:type="xsd:string" xsi:nil="true"/>
<desc_tipvia xsi:type="xsd:string">CALLE</desc_tipvia>
<desc_tipzon xsi:type="xsd:string" xsi:nil="true"/>
<desc_tpoemp xsi:type="xsd:string">SOCIEDAD ANONIMA CERRADA</desc_tpoemp>
<esActivo xsi:type="xsd:boolean">false</esActivo>
<esHabido xsi:type="xsd:boolean">true</esHabido>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
I already found the solution just a few more brackets.