Is there a way to get a website's IP using Apps Script

Viewed 208

I have looked at the UrlFetchApp documentation and I have searched the internet for a solution, but I don't see any way to retrieve the IP of a target URL in Apps Script. Is there a way to do this?

Thanks

1 Answers

You can do this using dns.google.com

function lookup(){
   var lookup = JSON.parse(UrlFetchApp.fetch("https://dns.google.com/resolve?name=wikipedia.com&type=A"));
}

The IP is in the response.

Related