From 9699037335ec31b912900433982b5195a6717637 Mon Sep 17 00:00:00 2001 From: Adrian Amaglio Date: Tue, 12 Jun 2018 17:32:43 +0200 Subject: [PATCH] new velov api --- index.php | 23 ++++++++--------------- style.css | 4 ++-- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/index.php b/index.php index a6acae2..06b1ebd 100644 --- a/index.php +++ b/index.php @@ -14,20 +14,13 @@ $SEND_BUTTON = [ /* Fetching velov API in an associative array. This form is easier to use as keys are ids */ $data = json_decode( - file_get_contents( - 'https://velov.grandlyon.com/fr/les-stations.html?type=777&tx_glstationsvelov_pi1%5Baction%5D=listOfVelovWidthInfoStation&tx_glstationsvelov_pi1%5Bcontroller%5D=StationVelov', - false, - stream_context_create([ - 'http' => [ - 'header' => "Content-type: application/x-www-form-urlencoded\r\n", - 'method' => 'POST', - 'content' => http_build_query([]) - ] - ]) + file_get_contents('https://api.jcdecaux.com/vls/v1/stations?apiKey=frifk0jbxfefqqniqez09tw4jvk37wyf823b5j1i&contract=lyon', + false ), true ); + /* Check if a filter is enabled */ if(isset($_GET['filter'])){ @@ -54,16 +47,16 @@ if(isset($_GET['filter'])){ SĂ©lectionnerNomVĂ©losPlaces Libres $station){ - if ( ! $filter || isset($_GET[$key])){ + if ( ! $filter || isset($_GET[$station['number']])){ echo ' - + - ' + ' ,$station['name'], ' - ',$station['AB'], ' - ', $station['ABS'], ' + ',$station['available_bikes'], ' + ', $station['available_bike_stands'], ' '; } } diff --git a/style.css b/style.css index 7b2fdd7..bfc5014 100644 --- a/style.css +++ b/style.css @@ -3,8 +3,8 @@ html{ color:white; } .success{ - color:green; + color: #18f218; } .danger{ - color: red; + color: #fb2d2d; }