Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias ip2c {
- if (!$1) || ($iptype($1) !== ipv4) && ($iptype($1) !== ipv6) { return 0 }
- var %v = ip2c_ $+ $rand(1,100000000000)
- jsonopen -ud %v http://ip-api.com/json/ $+ $1 $+ ?fields=country,countryCode
- if ($jsonerror) { return 0 }
- var %country = $json(%v,country).value
- var %country_code = $json(%v,countryCode).value
- if (%country) && (%country_code) { return %country ( $+ %country_code $+ ) }
- return 0
- }
Add Comment
Please, Sign In to add comment