What is my IP address ?
An Internet Protocol address (or IP Address) is a unique ID assigned to a device (computer/mobile) connected to the internet. It helps in identifying devices for routing data across the network. Currently there are 2 formats for an IP — IPv4 (e.g. 8.8.8.8) & IPv6 (e.g. 2001:4860:4860::8844)
The external IP address of your device is the ID that’s visible to the outside world (e.g. Google can see the IP from which you are searching on their google.com). Your IP is assigned by your internet service provider and it can change over time. It is useful to know your external IP for many applications e.g. you host a simple blog on your home computer and you want to keep the DNS record up to date.
Q : How do I find my IP address ?
A : Without further delay, here’s how you can find your public IP — in your favorite language with a secure API. Both IPv4 & IPv6 addresses are supported.
Shell
curl 'https://ipapi.co/ip/'
Ruby
require 'net/http'
puts Net::HTTP.get(URI('https://ipapi.co/ip/'))
Python
from requests import get
print get('https://ipapi.co/ip/').text
PHP
echo file_get_contents('https://ipapi.co/ip/')
Node.js
var https = require('https');https.get('https://ipapi.co/ip/', function(resp){
var body = ''
resp.on('data', function(data){
body += data;
}); resp.on('end', function(){
console.log(body);
});
});
jQuery
$.get('https://ipapi.co/ip/', function(data){
console.log(data)
})