first commit
This commit is contained in:
25
test.php
Normal file
25
test.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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));
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user