Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (19 sloc) 934 Bytes
// URL to get information about a bike station (STAR API)
$url = "";
// Here is the name of our station
$name = "Place+de+Bretagne";
$url .= $name;
// GET the json file coming from STAR API
$json_string = file_get_contents($url);
// Parse the JSON
$parsed_json = json_decode($json_string);
// Path of the ressource
$records = $parsed_json->{'records'}[0]->{'fields'};
// Extract the information
$bikes_available = $records->{'nombrevelosdisponibles'};
$data["bikes"] = (int)$bikes_available;
// echo the info
echo "Rides available at Place de Bretagne station : $bikes_available\n";