API и команды
Готовые команды для терминала, Windows CMD, PowerShell и кода. API-эндпоинты отдают лёгкий text/plain или JSON.
curl
curl https://ifconfig.coreix.ru
curl https://ifconfig.coreix.ru/ip
curl https://ifconfig.coreix.ru/all.json
curl https://ifconfig.coreix.ru/all.json?pretty=1
curl https://ifconfig.coreix.ru/headers
curl https://ifconfig.coreix.ru/geo.json
curl https://ifconfig.coreix.ru/city
curl https://ifconfig.coreix.ru/asn
curl https://ifconfig.coreix.ru/org
Windows CMD
curl.exe https://ifconfig.coreix.ru
curl.exe https://ifconfig.coreix.ru/ip
curl.exe https://ifconfig.coreix.ru/all.json?pretty=1
curl.exe https://ifconfig.coreix.ru/headers.json?pretty=1
curl.exe https://ifconfig.coreix.ru/geo.json?pretty=1
curl.exe https://ifconfig.coreix.ru/asn
curl.exe https://ifconfig.coreix.ru/org
for /f "delims=" %i in ('curl.exe -s https://ifconfig.coreix.ru/ip') do @echo Public IP: %i
Windows BAT-файл
@echo off
for /f "delims=" %%i in ('curl.exe -s https://ifconfig.coreix.ru/ip') do echo Public IP: %%i
pause
wget
wget -qO- https://ifconfig.coreix.ru/ip
wget -qO- https://ifconfig.coreix.ru/all.json?pretty=1
httpie
http https://ifconfig.coreix.ru/all.json pretty==1
http https://ifconfig.coreix.ru/headers.json
PowerShell
(Invoke-WebRequest -UseBasicParsing https://ifconfig.coreix.ru/ip).Content
Invoke-RestMethod https://ifconfig.coreix.ru/all.json
Python
python - <<'PY'
import urllib.request
print(urllib.request.urlopen("https://ifconfig.coreix.ru/ip").read().decode().strip())
PY
PHP
php -r 'echo trim(file_get_contents("https://ifconfig.coreix.ru/ip")), PHP_EOL;'
Node.js
node -e "fetch('https://ifconfig.coreix.ru/all.json').then(r=>r.json()).then(console.log)"