How to get xml data with php?

2

I'm trying to integrate my system with the jadlog carrier but I can not get the xml data with php.

jadlog return url

Result:

<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>
    <valorarResponse xmlns="">
        <ns1:valorarReturn xmlns:ns1="http://jadlogEdiws">
            <?xml version="1.0" encoding="utf-8" ?>
            <string xmlns="http://www.jadlog.com.br/JadlogEdiWs/services">
                <Jadlog_Valor_Frete>
                    <versao>1.0</versao>
                    <Retorno>114,11</Retorno>
                    <Mensagem>Valor do Frete</Mensagem>
                </Jadlog_Valor_Frete>
            </string>
        </ns1:valorarReturn>
    </valorarResponse>
</soapenv:Body>

I tried to get the data as follows:

$retornoJadlog= simplexml_load_string(file_get_contents($urlJadlog));

or

$retornoJadlog= simplexml_load_string($urlJadlog);

But in both ways return is null:

object(SimpleXMLElement)#4 (0) {
}
    
asked by anonymous 23.06.2016 / 20:08

1 answer

1

See if that's what a boss needs:

<?php

$xmlDoc = new DOMDocument();
$xmlDoc->load("http://www.jadlog.com.br:8080/JadlogEdiWs/services/ValorFreteBean?method=valorar&vModalidade=5&Password=C2o0E1m3&vSeguro=N&vVlDec=100,00&vVlColeta=10,00&vCepOrig=89062080&vCepDest=89062080&vPeso=30,30&vFrap=N&vEntrega=D&vCnpj=17977285000118");

$x = $xmlDoc->documentElement;
foreach ($x->childNodes AS $item) {
  print $item->nodeName . " = " . $item->nodeValue . "<br>";
}
?>
    
23.06.2016 / 20:27