$_valeur) { $url .= "&${_critere}=${_valeur}"; } // Options de la fonction de récupération du JSON include_spip('inc/distant'); $options = array( 'transcoder' => true, 'taille_max' => $taille_max ? $taille_max : _INC_DISTANT_MAX_SIZE * _TERRITOIRE_COEFF_MAX_DISTANT, ); // Acquisition du flux de données $flux = recuperer_url($url, $options); $reponse = array(); if (empty($flux['page'])) { spip_log("URL indiponible : ${url}", 'territoires' . _LOG_ERREUR); $reponse['erreur'] = 'url_indisponible'; } else { try { // Transformation de la chaîne json reçue en tableau associatif $reponse = json_decode($flux['page'], true); } catch (Exception $erreur) { $reponse['erreur'] = 'analyse_json'; spip_log("Erreur d'analyse JSON pour l'URL `${url}` : " . $erreur->getMessage(), 'territoires' . _LOG_ERREUR); } } return $reponse; }