Skip to content
TG007 community snippet #143

A simple IP to Country by biase

A simple IP to Country A simple non-socket ip to country that will return a country name based on ip.

By Snippets Added Dec 6, 2023
General IRC All snippets
mIRC script 18 lines
About this snippet

Overview

A simple IP to Country
A simple non-socket ip to country that will return a country name based on ip.
Source code

mIRC script

18 lines · 912 characters
;----------------------------------------------------------------------
; Author      : bruas aka biase @ Webchat, unclean @ DalNet, Lite @ KampungChat
; Name        : A simple IP to Country
; URL         : -
; Description : A simple non-socket ip to country that will return a country name based on ip.
;             : It will trigger when a user use like this $ip2country(<ip>).
; Example     : //echo $ip2country(216.58.196.46)
; Created     : 1509274412
;----------------------------------------------------------------------
alias ip2country {
  if ($longip($1)) {
    var %a ajax. $+ $regsubex($str(.,10),/./g,$mid($md5($time),$r(1,32),1))
    .comopen %a msxml2.xmlhttp
    noop $com(%a,send,$com(%a,open,1,bstr,GET,bstr,$+(http://geoip.nekudo.com/api/,$1),bool,true))
    .comclose %a $com(%a,ResponseText,2) $regex($com(%a).result,/"name":"(.+?)"\54/)
  }
  return $iif($regml(1),$v1)
}
Community

Comments

Want to join the discussion? Sign in to TG007.
No comments yet. Start the discussion.