4 ms·
I prefer ipinfo.io You can even lookup info for other up addresses. E.g. https://ipinfo.io/1.1.1.1 https://ipinfo.io/1.1.1.1
by mazamats 6y ago
I prefer ipinfo.io
You can even lookup info for other up addresses. E.g. https://ipinfo.io/1.1.1.1 https://ipinfo.io/1.1.1.1
- mazamats 6y agoPlus if you use curl, it will return JSON instead of HtML
- klohto 6y agocurl ifconfig.co/json
- jodrellblank 6y agoIf you use powershell / invoke-restmethod it will return json and get deserialised into a structured object, too. PS C:\> irm ipinfo.io PS C:\> $x = irm ipinfo.io PS C:\> $x.timezone Europe/London Personally, I use http://checkip.dyndns.org/ http://checkip.dyndns.org/ by habit, with its one-line return.
- majkinetor 6y agoNo it wont, server need to return JSON format itself. Your example doesn't work. It needs to be: irm ipinfo.io/json Your other example can be get like this: irm http://checkip.dyndns.org | % HTML | % body
- JimDabell 6y agoIt will work. The server will return JSON. The URL http://ipinfo.io/ http://ipinfo.io/ returns HTML if the Accept header indicates that you want HTML, and JSON if there is no header, a wildcard header, or a header that requests JSON. As far as I can see, irm doesn’t add an Accept header, so the command jodrellblank provided will fetch JSON and work correctly.
- majkinetor 6y agoDoesnt work on Windows 10 using latest pwsh
- jodrellblank 6y agoWorks on Windows 10 using Windows PowerShell. In Pwsh it does seem to need /json
- tyingq 6y agoThis one supports other IPs also: https://ifconfig.co/?ip=1.2.3.4 https://ifconfig.co/?ip=1.2.3.4 And JSON: https://ifconfig.co/json?ip=1.2.3.4 https://ifconfig.co/json?ip=1.2.3.4
- mazamats 6y agoThe URL is cleaner with ipinfo.io, don't have to specify GET parameters with it.