Kachelmann Vorhersage API mittels PHP in WordPress einbinden.

Nachdem das Internet so gut wie nichts dazu zu finden hat, habe ich mir die Krümel selbst zusammengesucht.

Auf den Datenstream an sich will ich nicht eingehen. Die API kann man sich gegen Jahresgebühr bei Kachelmann buchen.

https://api.kachelmannwetter.com/v02/_doc.html#

https://wetterkanal.kachelmannwetter.com/neu-wetter-api-von-kachelmannwetter-meteologix/

Wenn die JSON [‚Jääson‘] Abfrage erfolgreich war, erhält man ein mehrfeldriges Array in dieser Form:

/

stdClass Object
(
    [lat] => ,,,,
    [lon] => 8.667
    [alt] => 203
    [resolution] => SUPER_HIGH
    [timeZone] => Europe/Berlin
    [systemOfUnits] => metric
    [run] => 2024-10-15T06:00:00+00:00
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [dateTime] => 2024-10-16
                    [dayName] => tomorrow
                    [tempMax] => 22.3
                    [tempMin] => 12.8
                    [precCurrent] => 0.2
                    [windGust] => 9.9
                    [windSpeed] => 3.7
                    [windDirection] => 114
                    [sunHours] => 7.9
                    [cloudCoverage] => 28
                    [weatherSymbol] => partlycloudy
                    [risks] => Array
                        (
                        )

                    [timeOfDay] => stdClass Object
                        (
                            [night] => stdClass Object
                                (
                                    [timeOfDay] => night
                                    [isDay] => 
                                    [tempMax] => 15.1
                                    [tempMin] => 14.3
                                    [precCurrent] => 0.2
                                    [windGust] => 9.9
                                    [windSpeed] => 5
                                    [windDirection] => 112
                                    [weatherSymbol] => cloudy
                                    [risks] => Array
                                        (
                                        )

                                )

                            [morning] => stdClass Object
                                (
                                    [timeOfDay] => morning
                                    [isDay] => 1
                                    [tempMax] => 19
                                    [tempMin] => 12.8
                                    [precCurrent] => 0
                                    [windGust] => 6.1
                                    [windSpeed] => 1.2
                                    [windDirection] => 117
                                    [weatherSymbol] => partlycloudy
                                    [risks] => Array
                                        (
                                        )

                                )

                            [afternoon] => stdClass Object
                                (
                                    [timeOfDay] => afternoon
                                    [isDay] => 1
                                    [tempMax] => 22.3
                                    [tempMin] => 19.6
                                    [precCurrent] => 0
                                    [windGust] => 9.5
                                    [windSpeed] => 3
                                    [windDirection] => 105
                                    [weatherSymbol] => partlycloudy
                                    [risks] => Array
                                        (
                                        )

                                )

                            [evening] => stdClass Object
                                (
                                    [timeOfDay] => evening
                                    [isDay] => 
                                    [tempMax] => 19
                                    [tempMin] => 17.9
                                    [precCurrent] => 0
                                    [windGust] => 9.9
                                    [windSpeed] => 5.6
                                    [windDirection] => 119
                                    [weatherSymbol] => partlycloudy
                                    [risks] => Array
                                        (
                                        )

                                )

                        )

                )

            [1] => stdClass Object
                (
                    [dateTime] => 2024-10-17
                    [dayName] => thursday
                    [tempMax] => 21
                    [tempMin] => 14.8
                    [precCurrent] => 0.2
                    [windGust] => 7.6

Reihenfolge:

Erst den JSON Stream ordentlich auslesen. Das habe ich anfänglich erst einmal außerhalb von WordPress gemacht.

2 be continued.

Check Also

Push Test 2

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert