Enviado em 31/07/2021 - 10:30h
Prezados,<?php
$url = ...;
$json = file_get_contents($url);
$dados = json_decode($json, true);
echo "<pre>";
print_r($dados);
?>
Warning: file_get_contents(https://www.car.gov.br/publico/imoveis/getImovel?lat=-2.449376438504347&lng=-49.04754638759188): Failed to open stream: Redirection limit reached, aborting in ... on line 5
<?php
$url = ...;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$dados = curl_exec($ch);
curl_close($ch);
echo "<pre>";
var_dump(json_decode($dados, true));
?>