/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // Instantiate a Forecaster object using a file cache // XML data from the NOAA API will be cached for 1 HOUR in the specified file location $config = new \noaa\weather\Configuration(); $config->setCache(new \noaa\weather\cache\FileCache(dirname(__FILE__) . '/cache')); $forecaster = new \noaa\Forecaster($config); // fetch a CurrentWeather instance for a specific station ID // find station IDs here: http://www.weather.gov/xml/current_obs/ try { $current = $forecaster->getCurrentWeather("KMUO"); } catch (\Exception $e) { echo "Error: " . $e->getMessage() . "\n"; exit(1); } // display var_dump($current); }