Getting the IP address of a specific web page (with Shortcuts)

I’m looking at making a little shortcuts that would find my current IP address for my Synolgo. The NAS in question is virtual machine running DDSM with a VPN. I’ve given it a ddns domain name so I can get to it and know it’s IP address with a site like this but how to I automate this? I can get Shortcut to open the website, but how to enter my domain name in the form in safari, or is there a better way to get that info without even going to a web site?
The goal is, I want to check if my vpn is still working and looking at the IP will tell me if it is. If it’s not, then I would need to fix it.

One way you could try is to open the page in question in a desktop browser, then open the developer tools (on Windows & Firefox or Chrome its by pressing F12), navigate to the networks tab (or network monitoring,…) and enter the information in the website and send it off. There should appear at least one entry in the network tab. If there are more, most of the time it’s the first one you’ll need. Click on it. Then it opens a sidebar thingy with all the details of the request.

Just transfer the url, the method and any header settings that seem to have to do something with your domain (not all are needed most of the time) to Shortcuts into the Get Contents of URL action

In the same sidebar thing you can also have a look at the answer of the request. From there you can work out, how to get the IP address.

You can also use this method to log into websites that do not provide any API. The only downside is that once the website changes, you have to update your Shortcut.

You can probably use Google’s DNS lookup. You just then have to parse the JSON

Web Page

Direct lookup - returns JSON

1 Like

@Kevin_Tierney You beat me to it while I was compiling this shortcut!

This uses Google’s API to get the IP:

1 Like

thanks @benbacardi this is exactly what I was looking for. As an aside, I found a script that I run directly on my Synology to check if the VPN is connected or not, if it’s not, then it connects it. My goal with the shortcut was to manually check it on my iPhone while away. I’ll still check to see if my script is running, but it should send me an error if it fails, so I should be covered, anyway, thanks again!

1 Like

Thanks for creating this. Do you happen to know how to make the shortcut copy the iPhone address so I can paste it in my work alarm app?

Thank you

Welcome! Sure, there’s a “Copy to Clipboard” action provided by iOS you can use. Just tack that on the end.