Calculate Sunrise and Sunset Value from IP Address PHP Script

Calculate Sunrise and Sunset Value from IP Address PHP Script

The example demonstrate you on how to calculate the sunrise and sunset value from IP address, or to be specific - the geolocation from IP address, without the use of weather library.

This solution requires a geolocation table, such as the DB11.LITE database which can be downloaded free from lite.ip2location.com. I would like to keep the source code zip small, so, please download it from http://lite.ip2location.com. Note: the database here refers to the IP2Location BIN format, in which all geolocation data contains inside a single BIN file for accessing that free you from database setup.

The code is pretty straight-forward and easy to be understood. A complete copy (without the database) has been included in the zip file for your download.

In summary, this solution will extract the timezone value from the IP address, the visitor's IP address, and perform the calculation using PHP library and return the sunrise and sunset information.

Before running the sample code, please make sure all files are saved into the same folder.

 

 

Comments

Popular posts from this blog

Motos Android Mame Game Download

StatusNet Micro Blog PHP Script Free Download

1941 Counter Attack (Japan) Windows Game Download