4

It seems it's possible to extract website title into a row, but how to extract IP address of the host into a row?

So for given any hostname (e.g. webapps.stackexchange.com) it should return IP address (e.g. 198.252.206.16).

3 Answers 3

6

Probably it's only possible by using some 3rd party web services which return IP addresses in HTML/XML format, so you can parse it via IMPORTXML.

In the example:

=importxml("http://xml.utrace.de/?query=webapps.stackexchange.com","//ip")

would return 198.252.206.16.

Here is an example with a dynamic row as an input (e.g. A1):

=importxml("http://xml.utrace.de/?query=" & A1,"//ip")
4
  • 1
    +1; You don't have to use the CONCATENATE to build the query. This works as well: =importxml("http://xml.utrace.de/?query="&"webapps.stackexchange.com","//ip") Oct 27, 2014 at 20:29
  • @JacobJanTuinstra: Thanks, you've right. It was left over when I was testing it with dynamic rows as an input. I've updated with the version without it.
    – kenorb
    Oct 27, 2014 at 21:14
  • 1
  • 1
    @JacobJanTuinstra: Thanks, that was useful. Didn't know about & operator:)
    – kenorb
    Oct 27, 2014 at 21:51
3

I found this works quite well with the following provider:

=importxml("http://freegeoip.net/xml/webapps.stackexchange.com", "//IP")

or dynamically:

=importxml("http://freegeoip.net/xml/" & A1,"//IP")
1
=REGEXREPLACE(QUERY(IMPORTDATA("http://xml.utrace.de/?query="&A20), 
 "where Col1 contains 'ip'"), "<ip>|</ip>", "")

0

=INDEX(IMPORTHTML("https://tools.keycdn.com/geo?host="&A20, "table", 1), 1, 2)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.