Query own IP (IPv4 or IPv6) as JSON: GET https://ip.nf/me.json
Query own IP (IPv4 or IPv6) as XML: GET https://ip.nf/me.xml
Query own IP (IPv4 or IPv6) as Text: GET https://ip.nf/me.txt
Query own IPv6 IP: GET http://ipv6.ip.nf/me.json
Query own IPv4 IP: GET http://ipv4.ip.nf/me.json
Query specific IP: GET https://ip.nf/208.80.154.224.json
Query IPv6 IP: GET https://ip.nf/2620:0:861:ed1a::1.json
JSONP: GET https://ip.nf/208.80.154.224.json?callback=jQuery_12345
CORS: send HTTP Header Origin
, default: *
$(document).ready(function() { $.getJSON( "https://ip.nf/me.json", function( data ) { $("#ip").html(data.ip.ip); $("#location").html(data.ip.city + " (" + data.ip.country + ")"); }); });
<?php $ip = json_decode(file_get_contents(sprintf('https://ip.nf/%s.json', $_SERVER["REMOTE_ADDR"]))); printf("Your IP: %s<br />", $ip->ip->ip); printf("Your Location: %s (%s)<br />", $ip->ip->city, $ip->ip->country); ?>