Hi guys,
here we are again with another weird issue that i'm not able to figure it out, thank you in advance to all the good Samaritan that will help me.
Suddenly i'm not getting anymore the weather forecast on the website under "Previsioni" column of ajax-dashboard.
http://meteorsago.altervista.org/swpi/and i get the error "Error: no forecast data was found in JSON from api.weather.gov"
The error comes from a check executed on the WC-forecast.php file at line 589 ish
I enabled the debug available around line 454 and i got this:
<!-- WC-forecast.php (ML) Version 1.05 - 01-Jan-2021 on PHP 5.6.40 -->
<!-- autoSetTemplate using narrow aspect. -->
<!-- WC_API Raw LatLong='37.27465,-122.02295' -->
<!-- WC API New URL='https://api.weather.com/v3/wx/forecast/daily/5day?format=json&units=m&language=it-IT&apiKey=<removed>&geocode=37.27465,-122.02295' -->
<!-- loading from ./cache/WC-forecast-json-0-m-it.txt (5311 bytes) -->
<!-- using charsetInput='UTF-8' charsetOutput='ISO-8859-1' doIconv='1' doRTL='' -->
<!-- processing JSON entries for forecast -->
<!-- rawJSON size is 5307 bytes -->
<!-- WC_prepareJSON: Success. Valid UTF-8. -->
<!-- json_decode returns - Syntax error, malformed JSON -->
using chatgpt i've been able to fix the syntax error removing the header curl parameter from true to false:
curl_setopt($ch, CURLOPT_HEADER, false);
and applying this before "$rawJSON = WC_prepareJSON($rawJSON);" around line 447:
$rawJSON = trim($response);
<!-- WC-forecast.php (ML) Version 1.04 - 22-Mar-2019 on PHP 5.6.40 -->
<!-- autoSetTemplate using narrow aspect. -->
<!-- WC_API Raw LatLong='45.92670,12.43850' -->
<!-- WC API New URL='https://api.weather.com/v3/wx/forecast/daily/5day?format=json&units=m&language=it-IT&apiKey=<removed>&geocode=45.92670,12.43850' -->
<!-- loading from ./cache/WC-forecast-json-0-m-it.txt (5634 bytes) -->
<!-- using charsetInput='UTF-8' charsetOutput='ISO-8859-1' doIconv='1' doRTL='' -->
<!-- processing JSON entries for forecast -->
<!-- rawJSON size is 5630 bytes -->
<!-- WC_prepareJSON: Success. Valid UTF-8. -->
<!-- json_decode returns - No errors -->
but i'm still getting the error object of this thread, so the header shouldn't be the main issue.
The JSON looks the same as some days ago except for the header but cleaning it with the fixes above i can exclude this as an issue.
{"calendarDayTemperatureMax":[15,19,20,22,17,15],"calendarDayTemperatureMin":[5,6,9,10,12,12],"dayOfWeek":["mercoledì","giovedì","venerdì","sabato","domenica","lunedì"],"expirationTimeUtc":[1744172392,1744172392,1744172392,1744172392,1744172392,1744172392],"moonPhase":["Gibbosa crescente","Gibbosa crescente","Gibbosa crescente","Plenilunio","Plenilunio","Gibbosa calante"],"moonPhaseCode":["WXG","WXG","WXG","F","F","WNG"],"moonPhaseDay":[11,12,13,14,15,16],"moonriseTimeLocal":["2025-04-09T16:22:20+0200","2025-04-10T17:28:28+0200","2025-04-11T18:32:39+0200","2025-04-12T19:37:55+0200","2025-04-13T20:43:17+0200","2025-04-14T21:50:44+0200"],"moonriseTimeUtc":[1744208540,1744298908,1744389159,1744479475,1744569797,1744660244],"moonsetTimeLocal":["2025-04-09T05:21:34+0200","2025-04-10T05:37:17+0200","2025-04-11T05:51:47+0200","2025-04-12T06:06:08+0200","2025-04-13T06:21:37+0200","2025-04-14T06:39:28+0200"],"moonsetTimeUtc":[1744168894,1744256237,1744343507,1744430768,1744518097,1744605568],"narrative":["Poco nuvoloso. Massime da 14 a 16° C e minime da 5 a 7° C.","Poco nuvoloso. Massime da 18 a 20° C e minime da 8 a 10° C.","Quasi sereno. Massime da 19 a 21° C e minime da 9 a 11° C.","Poco nuvoloso. Massime da 21 a 23° C e minime da 11 a 13° C.","Acquazzoni nel pomeriggio. Massime da 16 a 18° C e minime da 11 a 13° C.","Pioggia. Massime da 14 a 16° C e minime da 11 a 13° C."],"qpf":[0.0,0.0,0.0,0.0,4.46,38.18],"qpfSnow":[0.0,0.0,0.0,0.0,0.0,0.0],"sunriseTimeLocal":["2025-04-09T06:34:40+0200","2025-04-10T06:32:48+0200","2025-04-11T06:30:57+0200","2025-04-12T06:29:07+0200","2025-04-13T06:27:17+0200","2025-04-14T06:25:28+0200"],"sunriseTimeUtc":[1744173280,1744259568,1744345857,1744432147,1744518437,1744604728],"sunsetTimeLocal":["2025-04-09T19:49:38+0200","2025-04-10T19:50:56+0200","2025-04-11T19:52:14+0200","2025-04-12T19:53:32+0200","2025-04-13T19:54:50+0200","2025-04-14T19:56:08+0200"],"sunsetTimeUtc":[1744220978,1744307456,1744393934,1744480412,1744566890,1744653368],"temperatureMax":[15,19,20,22,17,15],"temperatureMin":[6,9,10,12,12,12],"validTimeLocal":["2025-04-09T07:00:00+0200","2025-04-10T07:00:00+0200","2025-04-11T07:00:00+0200","2025-04-12T07:00:00+0200","2025-04-13T07:00:00+0200","2025-04-14T07:00:00+0200"],"validTimeUtc":[1744174800,1744261200,1744347600,1744434000,1744520400,1744606800],"daypart":[{"cloudCover":[58,37,45,31,25,47,36,56,87,96,100,100],"dayOrNight":["D","N","D","N","D","N","D","N","D","N","D","N"],"daypartName":["Oggi","Stasera","Domani","Domani sera","venerdì","Venerdì notte","sabato","Sabato notte","domenica","Domenica notte","lunedì","Lunedì notte"],"iconCode":[30,29,30,29,34,29,30,29,39,11,12,12],"iconCodeExtend":[3000,2900,3000,2900,3400,2900,3000,2900,7103,1100,1200,1200],"narrative":["Poco nuvoloso. Massime 15° C. Venti da SE, da 10 a 15 km/h.","Poco nuvoloso. Minime 6° C. Venti da NE variabili.","Poco nuvoloso. Massime 19° C. Venti da S, da 10 a 15 km/h.","Poco nuvoloso. Minime 9° C. Venti da NNE variabili.","Quasi sereno. Massime 20° C. Venti da SSE, da 10 a 15 km/h.","Poco nuvoloso. Minime 10° C. Venti da NE variabili.","Poco nuvoloso. Massime 22° C. Venti da SE, da 10 a 15 km/h.","Poco nuvoloso. Minime 12° C. Venti da NE variabili.","Acquazzoni nel pomeriggio. Massime 17° C. Venti da ESE variabili. Prob. pioggia: 40%.","Acquazzoni. Minime 12° C. Venti da ENE variabili. Prob. pioggia: 70%.","Pioggia. Massime 15° C. Venti da ENE, da 10 a 15 km/h. Prob. pioggia: 80%. Piovosità di circa 12 mm. Possibilità di forti precipitazioni piovose locali.","Pioggia. Minime 12° C. Venti da NE, da 10 a 15 km/h. Prob. pioggia: 80%. Piovosità di circa 25 mm. Possibilità di forti precipitazioni piovose locali."],"precipChance":[2,24,5,6,5,6,4,20,39,69,83,78],"precipType":["rain","rain","rain","rain","rain","rain","rain","rain","rain","rain","rain","rain"],"qpf":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.07,3.4,18.48,19.69],"qpfSnow":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"qualifierCode":[null,null,null,null,null,null,null,null,null,null,"Q5050","Q5050"],"qualifierPhrase":[null,null,null,null,null,null,null,null,null,null,"Possibilità di forti precipitazioni piovose locali.","Possibilità di forti precipitazioni piovose locali."],"relativeHumidity":[64,82,64,80,70,85,63,83,80,94,96,98],"snowRange":["","","","","","","","","","","",""],"temperature":[15,6,19,9,20,10,22,12,17,12,15,12],"temperatureHeatIndex":[15,14,19,16,20,17,22,19,17,16,15,15],"temperatureWindChill":[6,6,6,9,9,10,10,12,12,12,12,12],"thunderCategory":[null,null,null,null,null,null,null,null,null,null,null,null],"thunderIndex":[0,0,0,0,0,0,0,0,0,0,0,0],"uvDescription":["Moderato","Basso","Moderato","Basso","Moderato","Basso","Moderato","Basso","Basso","Basso","Basso","Basso"],"uvIndex":[4,0,5,0,5,0,5,0,2,0,2,0],"windDirection":[143,41,186,31,160,46,143,50,108,67,59,52],"windDirectionCardinal":["SE","NE","S","NNE","SSE","NE","SE","NE","ESE","ENE","ENE","NE"],"windPhrase":["Venti da SE, da 10 a 15 km/h.","Venti da NE variabili.","Venti da S, da 10 a 15 km/h.","Venti da NNE variabili.","Venti da SSE, da 10 a 15 km/h.","Venti da NE variabili.","Venti da SE, da 10 a 15 km/h.","Venti da NE variabili.","Venti da ESE variabili.","Venti da ENE variabili.","Venti da ENE, da 10 a 15 km/h.","Venti da NE, da 10 a 15 km/h."],"windSpeed":[11,7,12,8,11,7,10,7,10,8,12,10],"wxPhraseLong":["Poco nuvoloso","Poco nuvoloso","Poco nuvoloso","Poco nuvoloso","Prevalentemente soleggiato","Poco nuvoloso","Poco nuvoloso","Poco nuvoloso","Acquazzoni PM","Acquazzoni","Pioggia","Pioggia"],"wxPhraseShort":["","","","","","","","","","","",""]}]}
The problem I think is probably related to the count of "$WCforecasticons" that probably is zero.
Do you guys have any suggestion about it? Did somebody faced this issue before?
Thank you so much
Andrea