A simple PHP script to tell a visitor's IP address and more information. Similar to ipecho.net/plain, but better :)
Go to file
Max Mehl d757e632d8 add CNAME output to standard list 2024-03-10 16:24:15 +01:00
.gitignore initial release 2017-01-10 03:44:42 +01:00
.htaccess make .git inaccessible via web 2023-06-14 13:39:19 +02:00
LICENSE initial release 2017-01-10 03:44:42 +01:00
README.md change domain nandus.net -> snapdns.eu 2024-03-10 16:18:32 +01:00
config.php.sample change domain nandus.net -> snapdns.eu 2024-03-10 16:18:32 +01:00
favicon.png add html header and favicon 2018-01-05 13:13:06 +01:00
index.php add CNAME output to standard list 2024-03-10 16:24:15 +01:00

README.md

IP Returner

A simple PHP script to tell a visitor's IP address and more information. This file is supposed to be on a webserver and can be configured by renaming config.php.sample to config.php.

Plain return

Example: [/][https://ip.snapdns.eu]

When the script is properly installed, one can visit/curl/wget the website to just receive one's public IP address. This is very useful in combination with other scripts (check out my snap-dyndns packages for example).

max@laptop ~> curl -Ls ip.snapdns.eu
91.62.68.1

Detailed return

Example: /detailed

Given the location of the script is ip.example.com, you can also receive more information about the HTTP headers or the IP's reverse lookup:

REMOTE_ADDR: 91.62.68.1
HTTP_X_FORWARDED_FOR: 91.62.68.1
HTTP_USER_AGENT: Mozilla/5.0 (X11; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/50.0
HTTP_CLIENT_IP:
HTTP_X_FORWARDED:
HTTP_FORWARDED_FOR:
HTTP_FORWARDED:
HTTP_HOST: ip4.snapdns.eu
HTTP_URI:

HOSTNAME: p5B3E4401.dip0.t-ipconnect.de
IPv4 REVERSE LOOKUP: 91.62.68.1

Additionally you will be given a whois output of your IP.

Custom DNS and IP lookup

You can also freely look up any hostname or IP. For domains, this will return a useful list of different DNS records (A, AAAA, NS, MX, TXT, SOA etc).

You will also be given a whois output of the domain or IP.

Ideal domain setup

In order to use IPv4- and IPv6-only domains, you'll have to have control over the DNS nameserver records of your own domain.

  • Set ip.example.com to be IPv4 (A Record) and IPv6 (AAAA Record) of your webserver
  • Set ip4.example.com to only be the IPv4 address
  • Set ip6.example.com to only be the IPv6 address

Make sure that the script is available through all those domains. Now your browser will use the default route for the ip subdomain, and the v4 or v6 route for the respective subdomains ip4 and ip6.