I have xml
down brought 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'm trying to read the status in the following ways, but it's just 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?