Welcome to the Cumulus Support forum.
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024
Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024
Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
USNO-sunmoon error messages
Moderator: saratogaWX
- aznetcowboy
- Posts: 356
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
USNO-sunmoon error messages
All of a sudden I am getting this error messages today:
Warning: Invalid argument supplied for foreach() in /home/gydfbaoo/public_html/get-USNO-sunmoon.php on line 360
Warning: Invalid argument supplied for foreach() in /home/gydfbaoo/public_html/get-USNO-sunmoon.php on line 371
What is causing this and what do I do to correct it? I have changed nothing in this script or any script for at least a couple months and then it was just for upgrades/updates.
Warning: Invalid argument supplied for foreach() in /home/gydfbaoo/public_html/get-USNO-sunmoon.php on line 360
Warning: Invalid argument supplied for foreach() in /home/gydfbaoo/public_html/get-USNO-sunmoon.php on line 371
What is causing this and what do I do to correct it? I have changed nothing in this script or any script for at least a couple months and then it was just for upgrades/updates.
- saratogaWX
- Posts: 1170
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: USNO-sunmoon error messages
It looks like the USNO has switched to HTTPS today.
Change get-USNO-sunmoon.php from to
Code: Select all
<!-- curl fetching 'http://api.usno.navy.mil/rstt/oneday?date=11/23/2018&coords=32.2217,-110.84444&tz=-7' -->
<!-- HTTP stats: RC=301 dest=199.211.133.93 port=80 (from sce=23.254.240.227)
Times: dns=0.000 conn=0.053 pxfer=0.053 get=0.059 total=0.112 secs -->
<!-- headers returned:
HTTP/1.1 301 Moved Permanently
Date: Fri, 23 Nov 2018 17:51:59 GMT
Server: Apache
Location: https://api.usno.navy.mil/rstt/oneday?date=11/23/2018&coords=32.2217,-110.84444&tz=-7
Content-Length: 301
Content-Type: text/html; charset=iso-8859-1
-->
Code: Select all
$USNOUrl = "http://api.usno.navy.mil/rstt/oneday?date=$lclToday&coords=$myLat,$myLong&tz=$myTZOffset";
Code: Select all
$USNOUrl = "https://api.usno.navy.mil/rstt/oneday?date=$lclToday&coords=$myLat,$myLong&tz=$myTZOffset";
- saratogaWX
- Posts: 1170
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: USNO-sunmoon error messages
I've released V3.02 with the https fix .. available now from the update tool page 23-Nov-2018, Base=*, Plugin-*
- aznetcowboy
- Posts: 356
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: USNO-sunmoon error messages
I did the update as you suggested and it has been working okay ever since... that is until today. This morning I am getting the error as follows:saratogaWX wrote: ↑Fri 23 Nov 2018 6:12 pm by saratogaWX » Fri Nov 23, 2018 11:12 am
I've released V3.02 with the https fix .. available now from the update tool page 23-Nov-2018, Base=*, Plugin-*
Warning: Invalid argument supplied for foreach() in /home/gydfbaoo/public_html/get-USNO-sunmoon.php on line 361
Warning: Invalid argument supplied for foreach() in /home/gydfbaoo/public_html/get-USNO-sunmoon.php on line 372
This is confusing. Do I need to go after another update?
![Confused :?](./images/smilies/icon_e_confused.gif)
- saratogaWX
- Posts: 1170
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: USNO-sunmoon error messages
No, no need to update the script. Your site is reporting to switch to the built-in calculations instead of using the USNO.
With the USNO having issues, just add (or change) your Settings.php to have<!-- get-USNO-sunmoon.php - Version 3.02 - 23-Nov-2018 -->
<!-- refetch seconds=1 -->
<!-- loading ./cache/USNO-moondata.txt from https://api.usno.navy.mil/rstt/oneday?d ... 4444&tz=-7 -->
<!-- curl fetching 'https://api.usno.navy.mil/rstt/oneday?d ... 4444&tz=-7' -->
<!-- curl Error: Connection timed out after 30001 milliseconds -->
<!-- HTTP stats: RC=0 dest= port=0 (from sce=)
Times: dns=0.003 conn=0.000 pxfer=0.000 get=30.002 total=30.002 secs -->
<!-- headers returned:
-->
<!-- Error loading from USNO API, cache not saved -->
<!-- loading finished. -->
<!-- processing JSON entries for Moon data -->
<!-- json_decode returns - Syntax error, malformed JSON -->
Code: Select all
$SITE['useUSNO'] = false;
- ConligWX
- Posts: 1570
- Joined: Mon 19 May 2014 10:45 pm
- Weather Station: Davis vPro2+ w/DFARS + AirLink
- Operating System: Ubuntu 22.04 LTS
- Location: Bangor, NI
- Contact:
Re: USNO-sunmoon error messages
Regards Simon
https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •
![Image](https://www.conligwx.org/banner_small.php)
https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •
- aznetcowboy
- Posts: 356
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: USNO-sunmoon error messages
While this sounds good (maybe even great), where does the codeConligWX wrote: ↑Fri 21 Dec 2018 4:24 pm by ConligWX » Fri Dec 21, 2018 9:24 am
just reported this over on your forums Ken.
https://www.wxforum.net/index.php?topic ... #msg366210
} else {
$Debug.= "<!-- Error loading from USNO API, cache not saved -->\n";
return ("");
}
get placed
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
-
- Posts: 1255
- Joined: Mon 09 Jul 2012 8:40 pm
- Weather Station: Davis VP2 Cabled
- Operating System: Windows 10 Pro
- Location: Auckland, New Zealand
- Contact:
Re: USNO-sunmoon error messages
PLEASE DISREGARD THIS SUGGESTION.
There are a couple of other changes required elsewhere to properly implement this modification.
BCJKiwi
Ken has given you the clue.
Provided you are using ver 3.02 of the script as recommended, you can switch between using USNO or built-in code. The built-in code does not provide all the variables that USNO does but sufficient for the standard website templates.
Instead of adding
return ("");
you can instead add
$useUSNO = false; // USNO fetch/process failed, set switch to false to use built-in calculations
As to where to do this, search for
$Debug.= "<!-- Error loading from USNO API
which is at line 164 in the original ver 3.02 get_USNO-sunmoon.php file
INSERT the new code on a new line immediately after the original line 164
Using this method, the normal operation will be to use USNO but if there is a problem accessing that data, then the built in calculations will be used automatically. Of course you could just switch to he built-in calculations permanently as suggested by Ken.
There are a couple of other changes required elsewhere to properly implement this modification.
BCJKiwi
Ken has given you the clue.
Provided you are using ver 3.02 of the script as recommended, you can switch between using USNO or built-in code. The built-in code does not provide all the variables that USNO does but sufficient for the standard website templates.
Instead of adding
return ("");
you can instead add
$useUSNO = false; // USNO fetch/process failed, set switch to false to use built-in calculations
As to where to do this, search for
$Debug.= "<!-- Error loading from USNO API
which is at line 164 in the original ver 3.02 get_USNO-sunmoon.php file
INSERT the new code on a new line immediately after the original line 164
Using this method, the normal operation will be to use USNO but if there is a problem accessing that data, then the built in calculations will be used automatically. Of course you could just switch to he built-in calculations permanently as suggested by Ken.
Last edited by BCJKiwi on Sun 23 Dec 2018 7:56 pm, edited 1 time in total.
- saratogaWX
- Posts: 1170
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: USNO-sunmoon error messages
I suggest it is better long-term to leave the basic script unmodified (so you can just replace it when it has a new release in the future) and to instead use the Settings.php entry to switch to internal calculations. If you are not into code compare old vs. new and refitting your mods, the Settings.php method is the way to have the least issues when updates are needed.
-
- Posts: 79
- Joined: Thu 23 Aug 2012 8:53 pm
- Weather Station: Ecowitt HP3501
- Operating System: Windows 10
- Location: Konin, Poland
Re: USNO-sunmoon error messages
I have similar problem even after updating the script: http://serwer1823145.home.pl/check-fetch-times.php
For a week following message has popped up:
For a week following message has popped up:
How to fix it?Warning: Invalid argument supplied for foreach() in /get-USNO-sunmoon.php on line 361
Warning: Invalid argument supplied for foreach() in /get-USNO-sunmoon.php on line 372
- saratogaWX
- Posts: 1170
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: USNO-sunmoon error messages
The api.usno.navy.mil site seems to be having issues for a couple of days.
Add to your Settings.php to force using the internal moon calculations instead of the USNO for moon data.
Add
Code: Select all
$SITE['useUSNO'] = false;