Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --get IP
- local website = http.get("http://l2.io/ip.js?var=myip")
- local ip = website.readAll()
- local ip = ip:gsub(";","")
- local ip = ip:gsub('"',"")
- local ip = ip:gsub("=","")
- local ip = ip:gsub("myip","")
- local ip = ip:gsub(" ","")
- --turn IP into location
- --Note: IP is just a place holder for
- --if it doesn't let us get the IP and
- --get the location in one function
- local locr = http.get("http://api.hostip.info/country.php?ip="..ip.."")
- local loc = locr.readAll()
- --if the location is private
- if loc == "XX" then
- print("Location private.")
- else --otherwise, if it's not private
- print(loc)
- end
Advertisement
Add Comment
Please, Sign In to add comment