Files
Domoticz/test.php
2025-03-06 11:09:58 +01:00

26 lines
739 B
PHP

<?php
function afficherArbre($array, $indentation = 0)
{
foreach ($array as $key => $value) {
echo str_repeat(' ', $indentation); // Indentation pour une meilleure visualisation
if (is_array($value)) {
echo "$key => \n";
afficherArbre($value, $indentation + 1); // Appel récursif pour les sous-tableaux
} else {
echo "$key => $value\n";
}
}
}
// URL contenant le JSON
$url = 'http://api.openweathermap.org/data/2.5/weather?q=La Gacilly,fr&APPID=feba3f4d926db3b358a25ec782bd1c8b&lang=FR&units=metric'; // Remplacez par votre URL JSON
// Récupération de la réponse JSON
$response = file_get_contents($url);
afficherArbre(json_decode($response,true));
?>