A simple IP to Country

By biase on Oct 29, 2017

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

;----------------------------------------------------------------------
; 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)
}

Comments

Sign in to comment.
ovelayer   -  Oct 18, 2018

seems to have stopped working

 Respond  
x1L22   -  Oct 30, 2017

Great job thans

biase  -  Nov 01, 2017

welcome.. glad to you like it

ovelayer  -  Nov 04, 2017

works fast and good..thanks

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.