<?php require_once 'php/tools.php'; require_once 'fred_api/Autoloader.php'; Fred_Autoloader::register(); $fredConf = parseJSONfile("config.json"); $api = new fred_api($fredConf->API_key); $category_api = $api->factory('category'); $parameters = array('category_id' => $id, 'file_type' => 'json'); $series = json_decode($category_api->series($parameters)); $category_api = null; $api = null; $results = $series->{'seriess'};
<?php require_once 'php/tools.php'; $infoDB = parseJSONfile("config.json"); try { $mdb = new PDO('mysql:host=' . $infoDB->host . ";\n dbname=" . $infoDB->db . "; charset=utf8", $infoDB->user, $infoDB->pass); $mdb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (Exception $e) { die("Erreur lors de la connection à la base de donnée: " . $e->getMessage()); }
<?php include 'tools.php'; $serieA = parseJSONfile("../data/serieB.json"); //var_dump($serieA->observations); array2cvs($serieA->observations, '../data/serieB.csv', 'date', 'value');