SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --get IP |
| 1 | + | --get location |
| 2 | - | local website = http.get("http://l2.io/ip.js?var=myip")
|
| 2 | + | local locr = http.get("http://api.hostip.info/get_html.php")
|
| 3 | - | local ip = website.readAll() |
| 3 | + | |
| 4 | - | |
| 4 | + | --remove IP line, we don't need it |
| 5 | - | local ip = ip:gsub(";","")
|
| 5 | + | local loc = loc:gsub("\nIP: [^\n]*", "")
|
| 6 | - | local ip = ip:gsub('"',"")
|
| 6 | + | --if couldn't find location |
| 7 | - | local ip = ip:gsub("=","")
|
| 7 | + | if string.find(loc, "Unknown") then |
| 8 | - | local ip = ip:gsub("myip","")
|
| 8 | + | print("Unknown location-IP's location may be private?")
|
| 9 | - | local ip = ip:gsub(" ","")
|
| 9 | + | else |
| 10 | - | |
| 10 | + | |
| 11 | - | --turn IP into location |
| 11 | + |