<?php // Require the Indego class require_once 'Indego.class.php'; // Instantiate the Indego class which will immediately discover all of the stations $indego = new Indego(); // Just get "university" stations $uni_stations = $indego->getStations('university'); print_r($uni_stations);
#!/usr/bin/env php <?php // Require the Indego class require_once 'Indego.class.php'; // Instantiate the Indego class $indego = new Indego(); // Get the stations that were requested if doing a search with a CLI argument if (isset($argv[1]) && !empty($argv[1])) { $search = trim($argv[1]); // Otherwise, get all stations } else { $search = ''; } // Get stations $stations = $indego->getStations($search); // Return red error message to standard error (stderr) if no stations were found and exit with non-zero if (empty($stations)) { fwrite(STDERR, "[31mNo stations found![0m\n"); exit(1); } // Loop through each bike-share station foreach ($stations as $station) { // List the current stations ID and name, padded with spaces so everything lines up echo str_pad($station->kioskId, 8) . ' ' . str_pad($station->name, 60); // Build a pretty graph for bikes at the current station $graph = ''; // Graph starts empty for ($bike = 0; $bike < $station->bikesAvailable; $bike++) { $graph .= "#"; } // And build another pretty graph of for empty docks at the current station