Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) ipdata.co IPv4 Geolocation LookupSee more Geolocation ExamplesDemonstrates how to lookup Geolocation data for an IPv4 address using the ipdata.co API.
; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oHttp = ObjCreate("Chilkat.Http") Local $sJsonStr = $oHttp.QuickGetStr("https://api.ipdata.co/149.250.207.170?api-key=MY_API_KEY") If ($oHttp.LastMethodSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf $oJson = ObjCreate("Chilkat.JsonObject") $oJson.EmitCompact = False Local $bSuccess = $oJson.Load($sJsonStr) ConsoleWrite($oJson.Emit() & @CRLF) ; Sample output: ; Use this online tool to generate parsing code from sample JSON: ; Generate Parsing Code from JSON ; { ; "ip": "149.250.207.170", ; "is_eu": true, ; "city": null, ; "region": null, ; "region_code": null, ; "country_name": "Germany", ; "country_code": "DE", ; "continent_name": "Europe", ; "continent_code": "EU", ; "latitude": 51.2993, ; "longitude": 9.491, ; "asn": "AS15854", ; "organisation": "EntServ Deutschland GmbH", ; "postal": null, ; "calling_code": "49", ; "flag": "https://ipdata.co/flags/de.png", ; "emoji_flag": "\ud83c\udde9\ud83c\uddea", ; "emoji_unicode": "U+1F1E9 U+1F1EA", ; "languages": [ ; { ; "name": "German", ; "native": "Deutsch" ; } ; ], ; "currency": { ; "name": "Euro", ; "code": "EUR", ; "symbol": "\u20ac", ; "native": "\u20ac", ; "plural": "euros" ; }, ; "time_zone": { ; "name": "Europe/Berlin", ; "abbr": "CEST", ; "offset": "+0200", ; "is_dst": true, ; "current_time": "2019-04-20T23:54:30.715507+02:00" ; }, ; "threat": { ; "is_tor": false, ; "is_proxy": false, ; "is_anonymous": false, ; "is_known_attacker": false, ; "is_known_abuser": false, ; "is_threat": false, ; "is_bogon": false ; }, ; "count": "2" ; } Local $sIp Local $bIs_eu Local $sCity Local $sRegion Local $sRegion_code Local $sCountry_name Local $sCountry_code Local $sContinent_name Local $sContinent_code Local $sLatitude Local $sLongitude Local $sAsn Local $sOrganisation Local $sPostal Local $sCalling_code Local $sFlag Local $sEmoji_flag Local $sEmoji_unicode Local $sCurrencyName Local $sCurrencyCode Local $sCurrencySymbol Local $sCurrencyNative Local $sCurrencyPlural Local $sTime_zoneName Local $sTime_zoneAbbr Local $sTime_zoneOffset Local $bTime_zoneIs_dst Local $sTime_zoneCurrent_time Local $bThreatIs_tor Local $bThreatIs_proxy Local $bThreatIs_anonymous Local $bThreatIs_known_attacker Local $bThreatIs_known_abuser Local $bThreatIs_threat Local $bThreatIs_bogon Local $sCount Local $i Local $iCount_i Local $sName Local $sNative $sIp = $oJson.StringOf("ip") $bIs_eu = $oJson.BoolOf("is_eu") $sCity = $oJson.StringOf("city") $sRegion = $oJson.StringOf("region") $sRegion_code = $oJson.StringOf("region_code") $sCountry_name = $oJson.StringOf("country_name") $sCountry_code = $oJson.StringOf("country_code") $sContinent_name = $oJson.StringOf("continent_name") $sContinent_code = $oJson.StringOf("continent_code") $sLatitude = $oJson.StringOf("latitude") $sLongitude = $oJson.StringOf("longitude") $sAsn = $oJson.StringOf("asn") $sOrganisation = $oJson.StringOf("organisation") $sPostal = $oJson.StringOf("postal") $sCalling_code = $oJson.StringOf("calling_code") $sFlag = $oJson.StringOf("flag") $sEmoji_flag = $oJson.StringOf("emoji_flag") $sEmoji_unicode = $oJson.StringOf("emoji_unicode") $sCurrencyName = $oJson.StringOf("currency.name") $sCurrencyCode = $oJson.StringOf("currency.code") $sCurrencySymbol = $oJson.StringOf("currency.symbol") $sCurrencyNative = $oJson.StringOf("currency.native") $sCurrencyPlural = $oJson.StringOf("currency.plural") $sTime_zoneName = $oJson.StringOf("time_zone.name") $sTime_zoneAbbr = $oJson.StringOf("time_zone.abbr") $sTime_zoneOffset = $oJson.StringOf("time_zone.offset") $bTime_zoneIs_dst = $oJson.BoolOf("time_zone.is_dst") $sTime_zoneCurrent_time = $oJson.StringOf("time_zone.current_time") $bThreatIs_tor = $oJson.BoolOf("threat.is_tor") $bThreatIs_proxy = $oJson.BoolOf("threat.is_proxy") $bThreatIs_anonymous = $oJson.BoolOf("threat.is_anonymous") $bThreatIs_known_attacker = $oJson.BoolOf("threat.is_known_attacker") $bThreatIs_known_abuser = $oJson.BoolOf("threat.is_known_abuser") $bThreatIs_threat = $oJson.BoolOf("threat.is_threat") $bThreatIs_bogon = $oJson.BoolOf("threat.is_bogon") $sCount = $oJson.StringOf("count") $i = 0 $iCount_i = $oJson.SizeOfArray("languages") While $i < $iCount_i $oJson.I = $i $sName = $oJson.StringOf("languages[i].name") $sNative = $oJson.StringOf("languages[i].native") $i = $i + 1 Wend |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.