sp; :metro_code, 17. :area_code, 18. :time_zone, 19. :continent_code, 20. :postal_code, 21. :isp_name, 22. :organization_name, 23. :domain, 24. :as_number, 25. :netspeed, 26. :user_type, 27. :accuracy_radius, 28. :country_confidence, 29. :city_confidence, 30. :region_confidence, 31. :postal_confidence, 32. :error] 33. 34.options = { :license => "YOUR_LICENSE_KEY", :ip => "24.24.24.24" } 35.OptionParser.new { |opts| 36. opts.banner = "Usage: omni-geoip-ws.rb [options]" 37. 38. opts.on("-l", "--license LICENSE", "MaxMind license key") do |l| 39. options[:license] = l 40. end 41. 42. opts.on("-i", "--ip IPADDRESS", "IP address to look up") do |i| 43. options[:ip] = i 44. end 45.}.parse! 46. 47.uri = URI::HTTP.build(:scheme => 'http', 48. :host => 'geoip.maxmind.com', 49. :path => '/e', 50. :query => URI.encode_www_form(:l => options[:license], 51. :i => options[:ip])) 52. 53.response = Net::HTTP.get_response(uri) 54.
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>
|