Lunar Perigee and Apogee Calculator for 8999 Years in PHP Source Code

Language

LUNAR PERIGEES AND APOGEES CALCULATOR FOR THE 8999-YEAR RANGE FROM 1000 AD to 9998 AD

Built around the NASA.JPL Horizons API

By Jay Tanner - 2021
PHP v7.4.9

Since the release of the NASA/JPL Horizons online API in July of 2021, I've been trying to test it out for making special general-purpose ephemerides.

The web interface does a good job, but the tables it produces can be a bit bulky, so, instead of using the web interface, I decided to make a special-purpose ephemeris using PHP v7 with their API to do it more directly with some customizations.

The first program I've made so far is a lunar apogee and perigee calculator for an entire year with some basic features.

The computations include the local Julian Dates, calendar dates and times, and distances of all lunar perigees and apogees for any given year from 1000 to 9998 and any given time zone offset from UT.

Times prior to 1962 are based on UT1 and from 1962 onward UTC is used.

The distances may be output in kilometers (default) or miles.

I've put the program in the public domain for anyone to copy, use, modify and study for learning how to use the NASA/JPL Horizons API.

There are still a few minor bugs that show up from time to time, mostly due to some erroneous time zone argument handling. Some abnormal time zone values will cause crashes if certain characters are entered. Valid input should give valid output.

I plan to create some specialized ephemerides when I get more experienced at using the NASA/JPL Horizons online API.

I posted a working copy on my website at:

http://neoprogrammics.com/!abc/nasa-jpl-horizons-work/lunar-perigees-apogees-calculator/

I have provided the source code on this site. You can download it by clicking the download button below this article.

How to run the project?

Locally

  • Download and Install any local web server such as XAMPP/WAMP to run the PHP Script.
  • Download the provided source code zip file. (download button is located below)
  • Since this project is using NASA.JPL Horizons API, an internet connection is required when running the project.

Setup & Installation

  1. Open your XAMPP/WAMP's Control Panel and start the Apache webserver.
  2. Extract the downloaded zip file.
  3. Copy the extracted source code folder.
  4. If you using XAMPP, paste the source code folder inside the 'htdocs' directory ie. C:\xampp\htdocs. And if using WAMPP, paste it inside the 'www' directory.
  5. Open a new tab in your browser and browse http://localhost/lunar-perigees-apogees-calculator/.

That's it! You can now test the LUNAR PERIGEES AND APOGEES CALCULATOR developed in PHP on your end.

I hope this LUNAR PERIGEES AND APOGEES CALCULATOR in PHP helps you with what you are looking for.

Enjoy

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment