1
How can I display the values of a JSON via echo in PHP, I am using the code below to receive the JSON from the Post Office website
$json_file = file_get_contents("http://cep.correiocontrol.com.br/$cep.json");This JSON has the following values:
$json_str = json_decode($json_file, true); //echo "$json_str";
{"bairro": "Jangurussu", "logradouro": "Rua 22", "cep": "60876470", "uf": "CE", "localidade": "Fortaleza"}Is there any way I can use echo to display these values?
Ex.
echo "Bairro: $bairro"; echo "Logradouro: $logradouro"; echo "CEP: $cep"; echo "UF: $uf"; echo "Localidade: $localidade";Upshot:
District: Jangurussu
Patio: Street 22
CEP:60876470
UF:CE
Locality: