'sunposa.php' Broken Again

For at least the past week the ‘sunposa.php’ script (a component of has been broken at ‘http://tycho.usno.navy.mil/cgi-bin/phase.gif’. It grinds away at that url for quite a while before abandoning it as unavailable. I also noticed that Ken’s ‘sunmoon.php’ falls over on the same image. HOWEVER, the script works here at http://frogville.us/wxastronomy.php!

I downloaded tman1991’s ‘sunposa.php’ script with ‘?sce=view’, and using ‘Compare It!’ found NO significant differences other than localization information between his code and mine. It’s part of his ‘wxastronomy.php’ package discussed in this thread.

I’m a lot confused here :? 8O :o Why does ‘http://tycho.usno.navy.mil/cgi-bin/phase.gif’ work for some and not others?

Maybe a firewall block at tycho.usno.navy.mil to your IP address (or IP address range)? Maybe the server is overloaded?

I’m getting

The connection has timed out

The server at tycho.usno.navy.mil is taking too long to respond.


for the URL.

Thanks, Ken! Is there anything we can to do about it? I just tried to load it from the computer on my DSL IP address and got the same problem, so it looks like a maybe it’s a server problem responding to queries outside a certain IP address range?

If it’s any consolation it’s down for me (208.xxx.xxx.xxx) too so I think it’s a deeper problem than just an IP range block.

This problem was identified before I think in a thread that was lost in the server crash so it has been going on a while (someone said access had been restricted especially to those outside the US) and it would cause my graph not to show. I changed to use WD’s moonicon which doesn’t show the dark part of the moon when made transparent but loads instantly on the graph.

I’ve put a band-aid on it by using my pre-existing ‘/ajax-images/moon/w/NH-moon’ gif’s and selecting the proper moon age by using ‘/Solaris/moonage.php’. You can get the code by using ‘?sce=view’ and the Solaris moonage.php is available at Github.

The white moon gif’s already have a transparent background, so resizing, converting to png, and saving the image is all that is needed. The need for resizing is questionable since my images are already 50x50px. These images are from Bashewa Weather, and just to be safe I added age 28 and age 29 images by copying 27 and 0, then renaming them.

My moontest script is available with ‘?sce=view’ as well.

I don’t think I’m going to bother ‘tycho.usno.navy.mil’ any more.

Many thanks for that info Jerry.
I have now changed to using Bashewa’s white moon images and getting the moon age day from WD’s %moonage% tag :slight_smile:

#-o I thought I would take the route less traveled. I thought about the %moonage% tag, but wanted the extra challenge of calculating it on the fly. (Yeah, right.) :slight_smile:

As long as the destination is the same then all routes are valid :wink:

If anyone is using my modified ‘sunposa.php’ with the Solaris script, my logic for adding a leading zero to the moon GIF name was flawed. Instead of

	$moonImage = 'ajax-images/moon/w/NH-moon'.(($age<9&&!strpos($age,'0'))?'0'.$age:$age).'.gif';

in line 63 should read

	$moonImage = 'ajax-images/moon/w/NH-moon'.(($age<10&&!strpos($age,'0'))?'0'.$age:$age).'.gif';

:oops: Brain cramp! I discovered the problem when ‘sunposa.php’ was broken again this morning.

The ‘moontest.php’ script was also broken in two places by using ‘(($age<9&&!strpos($age,‘0’))?‘0’.$age:$age)’ in two places rather than ‘(($age<10&&!strpos($age,‘0’))?‘0’.$age:$age)’. The corrected script can now be downloaded in this post above.

There is one further problem with the ‘sunposa.php’ and the ‘moontest.php’ I posted. I was unaware that the number of the ‘/ajax-images/moon’ gif’s was two days behind the moon age. This became apparent during the current waning of the moon as the crescent on my ‘sunposa.php’ graph was noticeably smaller than that displayed on my Astronomy Page and in Weather Display’s ‘moondetail1.gif’. The code of these scripts should now be correct and the moon crescent on the Astronomy Page, WeatherDisplay’s ‘moondetail1.gif’, and ‘sunposa.php’ graphic are identical.

Because the moon image for ‘sunposa.php’ is cached daily as ‘jpmoon.png’ unless you delete this image from your site the new code won’t take effect until tomorrow. After deletion on my site I had to reload my Astronomy Page twice before the new image and sunposa graphic appeared.

I’m trying to change my page to reflect your changes, but so far my images aren’t transparent and the age is wrong. I guess I’m not sure where the moontest script is inserted. Thanks in advance.
jp
http://www.jolietwx.com/sunposa.php

I’m sorry if I confused you with my ‘test’ script. It does nothing but verify that you’ve set up the /Solaris/moonphase.php properly. The transparency issue was mentioned by the ‘heavens.php’ authors, and I’m not sure why that is. The moon phase on your ‘sunposa.php’ graphic is also incorrect, so you need to keep working on it.

There’s something on your site that’s got ‘moontest.php’ hung up and therefore ‘sunposa.php’ is displaying an incorrect moon image. I can’t get any output from ‘moontest.php’ nor can I display the script with ‘moontest.php?sce=view’. Be sure you have the ‘/Solaris/moonphase.php’ script in place and properly referenced. Sometimes web hosts are fussy about whether or not to use ‘./’ in local directory references, and you might try modifying those in ‘moontest.php’.

If that doesn’t work, it may have to do with ‘.htaccess’ or ‘php.ini’ permissions, but you’ll need to sort it out with your web host’s tech gurus. Sorry I can’t be more helpful.

If you do resolve the problem, please share the details with us. Thanks!

Thanks for the quick reply, I’ll keep working.
jp

Hi Thanks for the fix

Thanks
BTrip

Thanks for posting Jerry.

Working now, with the Original sunposa.php I never got the moon to appear.
Only problem now is that I am using the black moon images and these are not transparent.

Does anyone know how one can make these gif’s with black background transparent in an easy way, like in photoshop.

Use the white moon images? Once they’re rendered transparent it shouldn’t make much difference, although I understand that there’s a chance of a small white border remaining.

I really didn’t do anything new but add the two extra moon days but everything appears to be working now. Thanks again for the 'fix"
jp

Oops spoke too soon, I’m stuck on a new moon, back to the drawing board.
Jp