Returns the visitor IP address (IPv4 or IPv6) in json format, useful for shell scripts or to find the external Internet routable address.
- Change
<YOUR_OWN_SECRET_KEY>
to your own secret - Upload modified script to a php server
- Visit your uploaded script with a browser or curl end with
?key=<YOUR_OWN_SECRET_KEY>
- Enjoy.
Assume this php script is hosted at https://api.exmaple.com/ip/index.php with secret key secret
.
$ curl 'https://api.example.com/ip/?key=password'
{"ipv4":"<your_ipv4_address_here>"}
$ curl 'https://api.example.com/ip/?key=password'
{"ipv4":"<your_ipv6_address_here>"}