27 lines
No EOL
939 B
PHP
27 lines
No EOL
939 B
PHP
<meta charset="utf-8">
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
<?php
|
|
$data = json_decode(file_get_contents('http://api.openweathermap.org/data/2.5/weather?q=Leipzig,DE&units=metric&lang=de&APPID=e1fbd5096c088db7a388f3a582c99b02'));
|
|
|
|
$night=0;
|
|
$icon=$data->weather[0]->icon;
|
|
$wetter['icon']="http://openweathermap.org/img/w/".$icon."@2x.png";
|
|
$wetter['w_id']=$data->weather[0]->id;
|
|
$wetter['cist']=round($data->main->temp);
|
|
$wetter['cmin']=round($data->main->temp_min);
|
|
$wetter['cmax']=round($data->main->temp_max);
|
|
$wetter['text']=$data->weather[0]->description;
|
|
|
|
$sunset = $data->sys->sunset;
|
|
$sunrise= $data->sys->sunrise;
|
|
|
|
if ($sunrise>time()) { $night=1; }
|
|
if ($sunrise<time() && $sunset>time()) { $night=0; }
|
|
if ($sunrise<time() && $sunset<time()) { $night=1; }
|
|
|
|
$template->assign('night', $night);
|
|
$template->assign('wetter', $wetter);
|
|
$template->assign('content', 'tpl/ajax/ue_wetter.tpl');
|
|
|
|
|
|
?>
|