Bepaal de landcode van een ipadres met openedge en ip-api.com
Via ip-api.com kun je de countrycode van een ipadres achterhalen.

/* get country code via ip-api */

USING System.*.
USING System.Web.*.
USING System.Net.*.
USING Progress.Json.ObjectModel.*.
    
def var oWebClient as CLASS WebClient no-undo.
def var oJsonParser    as ObjectModelParser NO-UNDO.
def var cDownload as longchar no-undo.
def var cIpAddress as char no-undo format "x(20)" init "64.233.191.255". 
def var cCountry as char no-undo.

define variable jsonMessage   AS JsonObject NO-UNDO.

oJsonParser = NEW ObjectModelParser( ).
                
oWebClient = new Webclient().
owebClient:Headers:Add("Charset", "text/html; charset=UTF-8").
oWebclient:Headers:Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)" ).
  
cDownload = oWebclient:DownloadString ( 'http://ip-api.com/json/' + cIpAddress ) no-error.

JsonMessage = CAST(oJsonParser:Parse(cDownload), JsonObject) no-error.
   
if jsonMessage:has("countryCode")
then cCountry = JsonMessage:GETCHARACTER( "countryCode" ).
else cCountry = "??".

delete object oWebClient.
delete object JSONMESSAGE.
delete object oJsonParser.

message cCountry.