tAdd weather script - adamsgaard.dk - my academic webpage
 (HTM) git clone git://src.adamsgaard.dk/adamsgaard.dk
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 349b57a1e8a57b681dbfbebd495443faa365b427
 (DIR) parent 8dc35b55d41eac40ecea7e5634078a024a201eed
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Thu,  5 Dec 2019 13:26:10 +0100
       
       Add weather script
       
       Diffstat:
         A output/weather.php                  |      69 ++++++++++++++++++++++++++++++
       
       1 file changed, 69 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/output/weather.php b/output/weather.php
       t@@ -0,0 +1,69 @@
       +<?php
       +        $zip = $_GET["z"];
       +        if ($zip == "") {
       +                $zip = 9520;
       +        }
       +?>
       +<!DOCTYPE html>
       +<html lang="en">
       +<meta charset="utf-8">
       +<meta name="viewport" content="width=device-width, initial-scale=1">
       +<title>Weather in <?php echo $zip; ?></title>
       +<style>
       +        body{
       +                margin:1em auto;
       +                max-width:40em;
       +                padding:0 .62em;
       +                font:1.2em/1.62 sans-serif;
       +                color:#4d4d4c;
       +        }
       +        h1,h2,h3 {
       +                color:#333;
       +                line-height:1.2;
       +        }
       +        a {
       +                color:#126b8c;
       +                text-decoration:none;
       +        }
       +        img {
       +                max-width:100%;
       +        }
       +        @media print {
       +                body{
       +                        max-width:none
       +                }
       +        }
       +</style>
       +<article>
       +<header>
       +<h1>Weather in <?php echo $zip; ?></h1>
       +<aside>
       +        <center>
       +                <p>
       +                        <a href="?z=1000">København</a>,
       +                        <a href="?z=7700">Thisted</a>,
       +                        <a href="?z=8000">Aarhus</a>,
       +                        <a href="?z=9520">Skørping</a>
       +                </p>
       +        </center>
       +</aside>
       +</header>
       +<img src="https://servlet.dmi.dk/byvejr/servlet/byvejr_dag1?by=<?php echo $zip; ?>&mode=long&eps=true" alt="0-2 days">
       +<br>
       +<img src="https://servlet.dmi.dk/byvejr/servlet/byvejr?by=<?php echo $zip; ?>&tabel=dag3_9&eps=true" alt="3-9 days">
       +<?php
       +        lon = ""; lat = "";
       +        if ($zip == 1000) {
       +                lon = "55.68"; lat = "12.57";
       +        elseif ($zip == 7700) {
       +                lon = "56.96"; lat = "8.70";
       +        elseif ($zip == 8000) {
       +                lon = "56.16"; lat = "10.20";
       +        elseif ($zip == 9520) {
       +                lon = "56.84"; lat = "9.89";
       +        }
       +        if ($lon != "") {
       +                echo "<br><img src=\"https://clearoutside.com/forecast_image_large/{$lon}/{$lat}/forecast.png\" alt=\"Clear Outside forecast\">";
       +        >
       +?>
       +</article>