$payload = json_decode(file_get_contents('php://input'), true); /* if(!$payload) { $payload = json_decode('{"1": 411157,"2": -960238,"3": "us"}', true); } */ $payload[1] = $payload[1] / 10000; $payload[2] = $payload[2] / 10000; $forecast_url = 'https://api.forecast.io/forecast/' . $api_key . '/' . $payload[1] . ',' . $payload[2] . '?units=' . $payload[3] . '&exclude=hourly,minutely,alerts'; $litecoin_url = 'https://btc-e.com/api/2/ltc_usd/ticker'; //ENTER YOUR API FROM LITECOINPOOL $coinbase_url = 'https://coinbase.com/api/v1/prices/buy'; $forecast = json_decode(get_data($forecast_url)); $coin = json_decode(get_data2($litecoin_url)); $coinbase = json_decode(get_data2($coinbase_url)); if (!$forecast) { die; } $response = array(); $icons = array('clear-day' => 0, 'clear-night' => 1, 'rain' => 2, 'snow' => 3, 'sleet' => 4, 'wind' => 5, 'fog' => 6, 'cloudy' => 7, 'partly-cloudy-day' => 8, 'partly-cloudy-night' => 9); $ltc_price = $coin->market->ltc_usd; $btc_price = $coin->market->btc_usd; $coinbase_price = $coinbase->total->amount; $sunset = $forecast->daily->data[0]->sunsetTime; $sunset_h = date('H', $sunset); $sunset_m = date('i', $sunset); $round_m = intval($sunset_m); while ($round_m < 10) { if ($round_m < 5) { $round_m = 59;
$minimum = false; $geslacht = ''; if ($compare_years == "on") { get_data_years($minimum, $show_abs, $cbs, $regio, $nr, $oms, $geslacht, $start_lft, $end_lft, $scale, $huishoudens, $target, $rand, $indicator, $pijler, $tables, $years, $cols, $num_decimals); } //uitgaven inkomensvoorzieningen $nr = 3054; $oms = 'begroting gemeentelijke uitgaven inkomensvoorzieningen'; $target = 'high'; $cols = array('val5', 'val11'); $eindjaar = false; $abs = false; $scale = 1; $num_decimals = 0; if ($compare_years == "off") { get_data2($cbs, $regio, $compare, $nr, $oms, $cols, $target, $rand, $cache_table, $indicator, $eindjaar, $abs, $scale, $num_decimals, $cache); } $tables = array(3054, 3054, 3054, 3054); $years = array(2012, 2013, 2014, 2015); $cols = array('val2', 'val8', 'val3', 'val9', 'val4', 'val10', 'val5', 'val11'); $show_abs = false; $minimum = false; $geslacht = ''; if ($compare_years == "on") { get_data_years($minimum, $show_abs, $cbs, $regio, $nr, $oms, $geslacht, $start_lft, $end_lft, $scale, $huishoudens, $target, $rand, $indicator, $pijler, $tables, $years, $cols, $num_decimals); } get_score($cbs, $compare, $num_comparisons, $rand, $indicator, $rand_pijler, $cache_table, $compare_years); /*ONDERSTEUNING MANTELZORGERS EN VRIJWILLIGERS*/ $indicator = 'ondersteuning mantelzorgers en vrijwilligers'; //random numer voor tijdelijke tabel $rand = rand();
$table .= sprintf("<td>%s</td>", $data[$yr][$code]); } else { $table .= "<td>0</td>"; } } $table .= "</tr>"; } $table .= "</table>"; } else { // Logic for by WFO by year $memkey = "vtec_counts_data_{$phenomena}_{$significance}"; $data = $memcache->get($memkey); $cachedwarning = '<div class="alert alert-warning">This information was cached within the past 24 hours and may not be up to the moment.</div>'; if ($clobber || !$data) { $data = get_data2(); $memcache->set($memkey, $data, false, 86400); $cachedwarning = ''; } $table = <<<EOF \t<table class="table table-striped"> \t<thead><tr><th>WFO</th><th>WFO Name</th> EOF; $years = array_keys($data); asort($years); while (list($i, $yr) = each($years)) { $table .= "<th>{$yr}</th>"; } $table .= "</tr></thead>\n"; reset($nt->table); while (list($key, $val) = each($nt->table)) {