0

I need to retrieve the IP address of some of my websites from a main dashboard in Rails, but I'm not sure how to go about it.

Googling so far has only returned answers on how to get the IP address of visitors.

I'm using HTTParty to parse the pages, can I use these requests to find out the IP somehow?

mind.blank
  • 4,820
  • 3
  • 22
  • 49
  • 1
    Use a DNS lookup, using whatever ruby's equivalent of `gethostbyname('www.example.com')` is. – Marc B Nov 27 '13 at 19:24
  • There you go http://stackoverflow.com/questions/2913226/getting-a-dns-txt-record-in-ruby – Pepe Nov 27 '13 at 19:27

1 Answers1

0

Thanks to Marc B's comment I found this simple solution:

>> require 'socket' #=> true
>> IPSocket::getaddress("www.google.com") #=> "74.125.79.147"
Community
  • 1
  • 1
mind.blank
  • 4,820
  • 3
  • 22
  • 49