Author Topic: Update to new Sun/Moon file error?  (Read 867 times)

0 Members and 1 Guest are viewing this topic.

Offline HamiltonNJWeather

  • Contributor
  • ***
  • Posts: 104
    • HamiltonWeather.Net
Update to new Sun/Moon file error?
« on: July 30, 2015, 09:01:35 AM »
Good Morning, all!!  just wanted to know if anyone has had any errors with the new 'Sun/Moon' update that was posted.  I get these two errors on my webpage after instatlling

Warning: Invalid argument supplied for foreach() in /home/horsham/www/www/get-USNO-sunmoon.php on line 351

Warning: Invalid argument supplied for foreach() in /home/horsham/www/www/get-USNO-sunmoon.php on line 360


The lines mentioned in my files are :

    351: foreach ($MoonJSON['sundata'] as $n => $d) {

    360: foreach ($MoonJSON['moondata'] as $n => $d) {

Any ideas?
John


Offline HamiltonNJWeather

  • Contributor
  • ***
  • Posts: 104
    • HamiltonWeather.Net
Re: Update to new Sun/Moon file error?
« Reply #1 on: July 30, 2015, 09:57:50 AM »
Not sure what the issue was, but it seems to have rectified itself....

http://www.horshamweather.com/wxastronomy.php
John


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6745
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Update to new Sun/Moon file error?
« Reply #2 on: July 30, 2015, 11:11:06 AM »
It was an existing cache file with the old format.. when the cache reloaded, the JSON was there to be read/parsed :)

New installs of the script can force a cache reload with wxastronomy.php?force=1

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline HamiltonNJWeather

  • Contributor
  • ***
  • Posts: 104
    • HamiltonWeather.Net
Re: Update to new Sun/Moon file error?
« Reply #3 on: July 30, 2015, 11:13:13 AM »
Thank you, Ken!  I know better!  Im blaming it on the lack of caffeine in coffee form at the moment...   \:D/
John


Offline iceman62

  • Member
  • *
  • Posts: 10
    • Météo - Achiet le Grand
Re: Update to new Sun/Moon file error?
« Reply #4 on: April 04, 2018, 11:26:52 PM »
Hello from France

I am currently experiencing the same problem.
I forced the update with with wxastronomy.php?force=1, and nothing makes, always the same error.
I deleted the cache file, checked the cache access rights but the file is not re-created.
I recreated the USNO-moondata.txt file by hand with access rights and still nothing. the file is still not updated!
My get-USNO-sunmoon.php file version is 3.01 - 20-Oct-2017.
I do not know what to do....

Any ideas?

Best regards,
Pierre

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6745
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Update to new Sun/Moon file error?
« Reply #5 on: April 04, 2018, 11:36:46 PM »
Hello from France

I am currently experiencing the same problem.
I forced the update with with wxastronomy.php?force=1, and nothing makes, always the same error.
I deleted the cache file, checked the cache access rights but the file is not re-created.
I recreated the USNO-moondata.txt file by hand with access rights and still nothing. the file is still not updated!
My get-USNO-sunmoon.php file version is 3.01 - 20-Oct-2017.
I do not know what to do....

Any ideas?

Best regards,
Pierre
I'd need a link to your website experiencing the issue to debug further.  From the described symptoms, it appears that the api.usno.navy.mil server is either not responding or is not connectable from your webserver at your hoster.

You can bypass the issue and use the built-in astonomy calculations by putting
Code: [Select]
$SITE['useUSNO'] = false; in Settings.php

To revert to using the USNO, simply change that Settings.php value to
Code: [Select]
$SITE['useUSNO'] = true; or delete the line (the script default is to use the USNO for sun/moon data.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6745
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Update to new Sun/Moon file error?
« Reply #6 on: April 04, 2018, 11:44:55 PM »
I just tried on one of my sites wxastronomy.php?force=1 doing a view-source on the page and found
Quote
<!-- get-USNO-sunmoon.php - Version 3.01 - 20-Oct-2017 -->
<!-- refetch seconds=1 -->
<!-- loading ./cache/USNO-moondata.txt from http://api.usno.navy.mil/rstt/oneday?date=04/04/2018&coords=37.27153397,-122.02274323&tz=-7 -->
<!-- curl fetching 'http://api.usno.navy.mil/rstt/oneday?date=04/04/2018&coords=37.27153397,-122.02274323&tz=-7' -->
<!-- HTTP stats:  RC=503 dest=199.211.133.93 port=80 (from sce=198.71.224.69)
      Times: dns=0.000 conn=0.019 pxfer=0.019 get=0.009 total=0.028 secs -->
<!-- headers returned:
HTTP/1.1 503 Service Unavailable
Content-Type: text/html; charset=UTF-8
Content-Length: 14959
Connection: close
P3P: CP="CAO PSA OUR"
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
 -->
<!-- Error loading from USNO API, cache not saved -->
<!-- loading finished. -->
<!-- processing JSON entries for Moon data -->
<!-- json_decode returns  - Syntax error, malformed JSON -->
<!-- note: 'fracillum' not in JSON, no 'illumination' is available. -->
<!-- USNOdata
Array
(
    [databy] => USNO
)
 -->
So the api.usno.navy.mil server is having the problem (503 Server Error) with the query.  Do the switch to $SITE['useUSNO'] = false; to avoid the issue.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6745
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Update to new Sun/Moon file error?
« Reply #7 on: April 04, 2018, 11:49:32 PM »
Even more curious .. loading the api.usno.navy.mil page in a browser shows it's blocked by Cyber Command  #-o  :roll:  ](*,)

I don't know if this is temporary or a new 'feature'.  Awkward for a public API like that to be suspended indefinitely.

I sent off a query to the sysadmins of www.usno.navy.mil noting the problem and asking when it might be resolved.
« Last Edit: April 04, 2018, 11:59:53 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline iceman62

  • Member
  • *
  • Posts: 10
    • Météo - Achiet le Grand
Re: Update to new Sun/Moon file error?
« Reply #8 on: April 05, 2018, 05:26:00 AM »
Thank you for the help you provided. I will wait until they solve their problem.
Congratulations on your job!
Have a good day.
Pierre

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6745
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Update to new Sun/Moon file error?
« Reply #9 on: April 05, 2018, 11:37:43 AM »
They are aware of the issue (an over zealous setting on the application firewall, likely)

I received this reply this morning:
Quote
Dear Ken,

Nothing has been discontinued. Apparently there is a higher level block in place preventing access to our public facing site. Our IT folks are working on it.

Please let us know if there is specific data we can provide you via email for today.

Respectfully,
Wendy
Astronomical Applications Dept.
U.S. Naval Observatory
________________________________________

Sent: Wednesday, April 04, 2018 11:58 PM
Subject: api.usno.navy.mil responds with 503-Blocked

Queries to api.usno.navy.mil are now returning 'Application Blocked' messages from US Cyber Command instead of the JSON data expected.

The same result is using the 'Sun/Moon data for one day' and other links on the www.usno.navy.mil site.

Has the API service been discontinued?  If not, please have the application firewall adjusted to allow queries like:
http://api.usno.navy.mil/rstt/oneday?date=04/04/2018&amp;coords=37.27153397,-122.02274323&amp;tz=-7
to again work.

Regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6745
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Update to new Sun/Moon file error?
« Reply #10 on: April 05, 2018, 12:55:09 PM »
Just received
Quote
   We believe that U.S. Cyber Command is no longer blocking our services. Please let us know whether you have any further difficulties. We regret the inconvenience. Thank for using our Complete Sun and Moon Data for One Day service.
      Respectfully,
      jlb
      Astronomical Applications Dep't
and tested.  The USNO sun/moon service via the API is operational again.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline iceman62

  • Member
  • *
  • Posts: 10
    • Météo - Achiet le Grand
Re: Update to new Sun/Moon file error?
« Reply #11 on: April 05, 2018, 11:07:05 PM »
Very good, tank you!
Pierre.