If you are a developer of a DevOps - it is possible to get your IP address using prepared samples
curl https://www.get-my-ip.info/api/ip
(Invoke-WebRequest -URI https://www.get-my-ip.info/api/ip).Content
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class GetMyIP {
public static void main(String[] args) throws IOException {
URL url = new URL("https://www.get-my-ip.info/api/ip");
URLConnection connection = url.openConnection();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
String ip = reader.readLine();
System.out.println(ip);
}
}
}
var http = require('https');
http.get('https://www.get-my-ip.info/api/ip', (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(data);
});
});
try:
import urllib2 as urlreq # Python 2.x
except:
import urllib.request as urlreq # Python 3.x
req = urlreq.Request("https://www.get-my-ip.info/api/ip")
print(urlreq.urlopen(req).read())
using System;
using System.Net.Http;
using System.Threading.Tasks;
public class GetMyIp
{
public static void Main()
{
var result = Task.Run(async () => {
using var client = new HttpClient();
var content = await client.GetStringAsync("https://www.get-my-ip.info/api/ip");
return content;
}).GetAwaiter().GetResult();
Console.WriteLine(result);
}
}
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {
resp, err := http.Get("https://www.get-my-ip.info/api/ip")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(body))
}