diff --git a/http_grab.ino b/http_grab.ino index 2e97ca2..32dffcf 100755 --- a/http_grab.ino +++ b/http_grab.ino @@ -34,19 +34,17 @@ String getHTML(String url, String post_params) { } String getHTML() { // gets the date and year from time.h library struct tm timeinfo; - char dayInMonth[3]; - char month[3]; + char dayInYear[4]; char year[5]; if(!getLocalTime(&timeinfo)){ Serial.println("Failed to obtain time"); return ""; } - strftime(dayInMonth,3, "%d", &timeinfo); - sprintf(month,"%d",timeinfo.tm_mon); // the month number has to be in range 0-11! + sprintf(dayInYear,"%d",timeinfo.tm_yday+1); strftime(year,5, "%Y", &timeinfo); - String post_params = "jahr=" + String(year) + "&monat=" + String(month) + "&tag=" + String(dayInMonth); // create post parameters of the form "jahr=2023&monat=2&tag=2" + String post_params = "jahr=" + String(year) + "&tagid=" + String(dayInYear); // create post parameters of the form "jahr=YYYY&tagid=III" where III is the day in the year return getHTML(url, post_params); }