url获取ip

require 'socket'

ip = TCPSocket.gethostbyname('www.baidu.com')
return =>["www.baidu.com", [], 2, "61.135.169.125", "61.135.169.121"]

@ip = ip.last

你可能感兴趣的:(url获取ip)