Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

AutoIt Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(AutoIt) ipdata.co IPv4 Geolocation Lookup

See more Geolocation Examples

Demonstrates how to lookup Geolocation data for an IPv4 address using the ipdata.co API.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat_9_5_0.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_9_5_0.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.