Created
January 1, 2015 22:06
-
-
Save orienterare/6db83c46ce98bb9b2f89 to your computer and use it in GitHub Desktop.
Prints the current level of a measuring station to a Panic Statusboard DIY widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# | |
## get the drive now json | |
$pegelURL = "https://www.pegelonline.wsv.de/webservices/rest-api/v2/stations/5952050.json?includeTimeseries=true&includeCurrentMeasurement=true"; | |
$process = curl_init($pegelURL); | |
curl_setopt($process, CURLOPT_HEADER, false); | |
curl_setopt($process, CURLOPT_RETURNTRANSFER, true); | |
$data = json_decode(curl_exec($process), true); | |
curl_close($process); | |
switch ($data['timeseries'][0]['currentMeasurement']['trend']) { | |
case -1: | |
$trend = "-"; | |
break; | |
case 0: | |
$trend = "="; | |
break; | |
case 1: | |
$trend = "+"; | |
break; | |
default: | |
$trend = ""; | |
break; | |
} | |
$pegel = $data['timeseries'][0]['currentMeasurement']['value'] / 100.0; | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="refresh" content="3600"> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf8" /> | |
<meta http-equiv="Cache-control" content="no-cache" /> | |
<style type="text/css"> | |
@font-face | |
{ | |
font-family: "Roadgeek2005SeriesD"; | |
src: url("http://panic.com/fonts/Roadgeek 2005 Series D/Roadgeek 2005 Series D.otf"); | |
} | |
body, * | |
{ | |
} | |
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td | |
{ | |
margin: 0; | |
padding: 0; | |
} | |
fieldset,img | |
{ | |
border: 0; | |
} | |
/* Settin' up the page */ | |
html, body, #main | |
{ | |
overflow: hidden; /* */ | |
} | |
body | |
{ | |
color: white; | |
font-family: 'Roadgeek2005SeriesD', sans-serif; | |
font-size: 20px; | |
line-height: 24px; | |
} | |
body, html, #main | |
{ | |
background: transparent !important; | |
} | |
.number | |
{ | |
font-size: 100px; | |
line-height: 80px; | |
margin-left: 10px; | |
margin-top: 0px; | |
color: white; | |
text-shadow:0px -2px 0px black; | |
} | |
.item { | |
display:block; | |
} | |
h2 { | |
font-size: 30px; | |
text-shadow:0px -2px 0px black; | |
text-transform: Uppercase; | |
line-height: 30px; | |
margin-bottom:5px; | |
} | |
</style> | |
</head> | |
<body onload="init()"> | |
<div id="main"> | |
<div class="number"><h2>Pegel <?=$data['longname']?></h2> | |
<?php echo number_format($pegel, 1);?> m <?= $trend ?></div> | |
</div><!-- main --> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment