Re:Ifconfig.co – Hacker-friendly “What is my IP address”
by jodrellblank on Tuesday March 30, 2021 @09:25AM
(#26634323)
If you use powershell / invoke-restmethod it will return json and get deserialised into a structured object, too.
Personally, I use http://checkip.dyndns.org/ by habit, with its one-line return.
[ Parent
| on HN ]
Re:Ifconfig.co – Hacker-friendly “What is my IP address”
by majkinetor on Tuesday March 30, 2021 @09:45AM
(#26634537)
No 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
Re:Ifconfig.co – Hacker-friendly “What is my IP address”
by JimDabell on Tuesday March 30, 2021 @11:12AM
(#26635532)
It will work. The server will return JSON. The URL 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.
Re:Ifconfig.co – Hacker-friendly “What is my IP address”
by majkinetor on Tuesday March 30, 2021 @11:26AM
(#26635699)
Doesnt work on Windows 10 using latest pwsh
Re:Ifconfig.co – Hacker-friendly “What is my IP address”
by jodrellblank on Tuesday March 30, 2021 @11:58AM
(#26636201)
Works on Windows 10 using Windows PowerShell. In Pwsh it does seem to need /json