This folder contains a simple PHP implementation of ReverseGeocoder endpoints.
reverse_geocode.phpgeocode.phpip2country.php
Each script has its own DB connection settings at the top ($dsn, $username, $password).
- Build/import data (see
../data/README.md). - Update DSN credentials in each PHP file.
- Deploy scripts to a PHP server with PDO support for your selected driver.
The shared API is documented in ../README.md.
This PHP implementation is expected to match that behavior for:
- request parameters
- success/error status codes
- response shapes
Runtime-specific note:
ip2country.phpcan fall back to request headers / server vars whenipis omitted- scripts currently respond with
application/javascriptfor compatibility with existing deployments
- Current scripts are intentionally minimal and use in-file settings.
- Content type is set as
application/javascriptfor compatibility with existing deployments. - Caching headers are long-lived for explicit lookup queries.
After changes:
- Verify each script can connect to the configured DB.
- Validate one successful and one invalid-input request per endpoint.
- Confirm IPv6 lookups still resolve expected countries.
- Confirm empty-result handling remains stable (no PHP warnings leaked).