PHP code example of attogram / weatherbit-api-wrapper
1. Go to this page and download the library: Download attogram/weatherbit-api-wrapper library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
attogram / weatherbit-api-wrapper example snippets
therbit = new \Attogram\Weatherbit\Weatherbit();
try {
// Always set your API Key
$weatherbit->setKey('YOUR-WEATHERBIT-API-KEY');
// Set location using one of the setLocationBy*() functions
$weatherbit->setLocationByCity('Amsterdam', 'NL');
// Gets array of current weather data
$currentWeather = $weatherbit->getCurrent();
} catch (Exception $exception) {
exit('Error: ' . $exception->getMessage());
}
print_r($currentWeather);