![](/media/cache/group/ep_srxDLMd.webp.50x50_q85.jpg)
Beispiel Abfrage Cloud Dienst Sunrise / Sunset
Dependencies: EthernetInterface MbedJSONValue mbed-rtos mbed
Fork of HTTP_GET by
Sunrise Sunset stellt ein API zur Verfügung, mittels dem die Sonnen Auf- und Untergangszeiten für einen bestimmten Ort abgefragt werden können.
Links
Beispiel: Abfrage für Zürich
http://api.sunrise-sunset.org/json?lat=47.3686498&lng=8.5391825
{"results": { "sunrise":"5:38:12 AM", "sunset":"5:31:12 PM", "solar_noon":"11:34:42 AM", "day_length":"11:53:00", "civil_twilight_begin":"5:07:47 AM", "civil_twilight_end":"6:01:38 PM", "nautical_twilight_begin":"4:32:04 AM", "nautical_twilight_end":"6:37:21 PM", "astronomical_twilight_begin":"3:55:32 AM", "astronomical_twilight_end":"7:13:52 PM" }, "status":"OK"}
Diff: HTTPClient/HTTPClient.cpp
- Revision:
- 2:c9e058ee6f87
- Parent:
- 1:2e29a33cd918
--- a/HTTPClient/HTTPClient.cpp Sat Jan 17 14:11:01 2015 +0000 +++ b/HTTPClient/HTTPClient.cpp Mon Jan 19 10:39:52 2015 +0000 @@ -360,13 +360,13 @@ buf[crlfPos] = '\0'; - char key[32]; + char key[36]; char value[MAXLEN_VALUE]; - key[31] = '\0'; + key[35] = '\0'; value[MAXLEN_VALUE - 1] = '\0'; - int n = sscanf(buf, "%35[^:]: %156[^\r\n]", key, value); + int n = sscanf(buf, "%35[^:]: %119[^\r\n]", key, value); if ( n == 2 ) { DBG("Read header : %s: %s", key, value); if( !strcmp(key, "Content-Length") ) {