1
I have the xml
brought down from a cUrl
.
<DistanceMatrixResponse>
<status>OK</status>
<origin_address>Muriaé - MG, 36880-000, Brasil</origin_address>
<destination_address>Patrocínio do Muriaé - MG, 36860-000, Brasil</destination_address>
<row>
<element>
<status>OK</status>
<duration>
<value>3939</value>
<text>1 hora 6 minutos</text>
</duration>
<distance>
<value>43371</value>
<text>43,4 km</text>
</distance>
</element>
</row>
</DistanceMatrixResponse>
I am trying in the following ways to read the status but it only gives empty.
When I give a print_r(), it reads all the xml on the screen.
$frete = new CalculaFrete(36880000, 36860000);
$freteXML1 = $frete->calculaFrete2();
$freteXML2 = simplexml_load_file($frete->calculaFrete2());
print "<pre>";
print_r($freteXML1);
print $freteXML1->row->element->status;
print $freteXML2->row->element->status;
print "</pre>";
Where am I going wrong?
The
$freteXML1
returns thexml
just above?– novic
normal, right
– Carlos Rocha