Free. No Log. No Tracking. Ever!
Carrier-Grade service
99.9999% SLA
Since 2012
2.800.000.000 requests in the last 24 hours
Obtaining Visitor's IP Address using JSON
- This basic API permits you to get the public IP address of the system making the call.
The function returns a JSON Text String with the IP address of the caller in either IPv4 or IPv6 format,
depending on the requester's protocol.
- Syntax : https://l2.io/ip.json Try it!
- Get JSON User's IP address
- IPv4 32-bit (four-byte) format, e.g. 195.80.156.70
- IPv6 128-bit format, e.g. 2a00:1b11:115:102:195:80:156:70
- If your script only supports IPv4 answers, you may want to use the following call to force IPv4:
- Syntax : https://www.l2.io/ip.json Try it!
- Get JSON User's IP address
- IPv4 32-bit (four-byte) format, e.g. 195.80.156.70
#curl https://l2.io/ip.json
{"ip":"195.80.156.70"}
#curl https://l2.io/ip.json?var=myip
{"myip":"195.80.156.70"}
Obtaining Visitor's IP Address in Javascript
- This API permits you to set the Javascript Variable of your choice with the public IP address
of the system making the call.
The call returns a piece of Javascript Code with the IP address of the caller in either IPv4 or IPv6 format,
depending on your request's protocol.
The Variable Name is defined through the 'var' parameter.
- Syntax : <script type="text/javascript" src="https://l2.io/ip.js?var=myip"></script>
- Set javascript variable "myip" to client's IP address
- IPv4 32-bit (four-byte) format, e.g. myip = "195.80.156.70";
- IPv6 128-bit format, e.g. myip = "2a00:1b11:115:102:195:80:156:70";
- If your script only supports IPv4 answers, you may want to use the following call instead :
- Syntax : <script type="text/javascript" src="https://www.l2.io/ip.js?var=myip"></script>
- Set javascript variable "myip" to client's IP address
- IPv4 32-bit (four-byte) format, e.g. myip = "195.80.156.70";
- The following lines could be inserted into your HTML page.
<script type="text/javascript">
var userip;
</script>
...
<script type="text/javascript" src="https://l2.io/ip.js?var=userip"></script>
...
<script type="text/javascript">
document.write("Your IP is :", userip);
</script>
- Syntax : <script type="text/javascript" src="https://l2.io/ip.js"></script>
- Display Client's IP address in your HTML page using javascript
- --> document.write('x.x.x.x');
Get IP Address with a simple HTTP(s) request
- This basic API permits you to get the public IP address of the system making the call.
The function returns a Text String with the IP address of the caller in either IPv4 or IPv6 format,
depending on your request's protocol.
- Syntax : https://l2.io/ip Try it!
- Diplay/Get Plain Text User's IP address
- IPv4 32-bit (four-byte) format, e.g. 195.80.156.70
- IPv6 128-bit format, e.g. 2a00:1b11:115:102:195:80:156:70
- If your script only supports IPv4 answers, you may want to use the following call to force IPv4:
- Syntax : https://www.l2.io/ip Try it!
- Diplay/Get Plain Text User's IP address
- IPv4 32-bit (four-byte) format, e.g. 195.80.156.70
- The following examples show how you can use this API from various language.
#shellperlpythonvb.net
#!/bin/sh
#Simple request using curl from a shell script.
#If your OS supports a dual stack IPv4/IPv6 you can add -4 or -6 option
#to force protocol selection, e.g. $(curl -4 -s https://l2.io/ip).
myip=$(curl -s https://l2.io/ip)
echo "My IP is $myip"
#!/usr/bin/perl
#Debian library : apt-get install libwww-perl
use LWP::UserAgent;
my $useragent = new LWP::UserAgent();
my $myip = $useragent->get('https://l2.io/ip')->content;
print 'My IP address is: '. $myip;
#!/usr/bin/env python
#Debian library : apt-get install python-requests
from requests import get
myip = get('https://l2.io/ip').text
print 'My IP address is: ', myip
Dim wc as New System.Net.WebClient
Dim myip as String = wc.DownloadString("https://l2.io/ip")
MessageBox.Show(myip)
The function returns a JSON Text String with the IP address of the caller in either IPv4 or IPv6 format,
depending on the requester's protocol.
{"ip":"195.80.156.70"}
#curl https://l2.io/ip.json?var=myip
{"myip":"195.80.156.70"}
of the system making the call.
The call returns a piece of Javascript Code with the IP address of the caller in either IPv4 or IPv6 format,
depending on your request's protocol.
The Variable Name is defined through the 'var' parameter.
var userip;
</script>
...
<script type="text/javascript" src="https://l2.io/ip.js?var=userip"></script>
...
<script type="text/javascript">
document.write("Your IP is :", userip);
</script>
The function returns a Text String with the IP address of the caller in either IPv4 or IPv6 format,
depending on your request's protocol.
#Simple request using curl from a shell script.
#If your OS supports a dual stack IPv4/IPv6 you can add -4 or -6 option
#to force protocol selection, e.g. $(curl -4 -s https://l2.io/ip).
myip=$(curl -s https://l2.io/ip)
echo "My IP is $myip"
#Debian library : apt-get install libwww-perl
use LWP::UserAgent;
my $useragent = new LWP::UserAgent();
my $myip = $useragent->get('https://l2.io/ip')->content;
print 'My IP address is: '. $myip;
#Debian library : apt-get install python-requests
from requests import get
myip = get('https://l2.io/ip').text
print 'My IP address is: ', myip
Dim myip as String = wc.DownloadString("https://l2.io/ip")
MessageBox.Show(myip)