Ruby Code Example

August 07, 2017

A quick Ruby function.

require 'net/http'
require 'net/https'

def get_ip(server,path,username,password)
http = Net::HTTP.new(server,443)
req = Net::HTTP::Get.new(path)
http.use_ssl = true
req.basic_auth username, password
response = http.request(req)
return response.body
end

puts get_ip('api.fraudguard.io','/ip/101.200.121.73','username','password')