Created
February 10, 2010 08:14
-
-
Save axgle/300121 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require "uri" | |
def ip2addr(ip="google.com") | |
url=URI.parse("http://ip138.com/ips8.asp") | |
res=Net::HTTP.post_form(url,:ip=>ip,:action=>2) | |
res.body.scan(/<ul class="ul1">(.*)<\/ul>/).to_s.scan(/<li>(.*?)<\/li>/) | |
end | |
puts ip2addr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment