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) MaxMind IPv4 Geolocation Lookup

Demonstrates how to lookup Geolocation data for an IPv4 address using the MaxMind GeoIP2 Precision Web Service.

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")

$oHttp.Login = "MAXMIND_ACCOUNT_ID"
$oHttp.Password = "MAXMIND_LICENSE_KEY"
$oHttp.Accept = "application/json"

; Lookup an IPv4 address: 149.250.207.170  (this was a randomly chosen address)
Local $sJsonStr = $oHttp.QuickGetStr("https://geoip.maxmind.com/geoip/v2.1/country/149.250.207.170")
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

; {
;   "continent": {
;     "code": "EU",
;     "geoname_id": 6255148,
;     "names": {
;       "ja": "?????",
;       "pt-BR": "Europa",
;       "ru": "??????",
;       "zh-CN": "??",
;       "de": "Europa",
;       "en": "Europe",
;       "es": "Europa",
;       "fr": "Europe"
;     }
;   },
;   "country": {
;     "is_in_european_union": true,
;     "iso_code": "DE",
;     "geoname_id": 2921044,
;     "names": {
;       "fr": "Allemagne",
;       "ja": "????????",
;       "pt-BR": "Alemanha",
;       "ru": "????????",
;       "zh-CN": "??",
;       "de": "Deutschland",
;       "en": "Germany",
;       "es": "Alemania"
;     }
;   },
;   "maxmind": {
;     "queries_remaining": 49999
;   },
;   "registered_country": {
;     "is_in_european_union": true,
;     "iso_code": "DE",
;     "geoname_id": 2921044,
;     "names": {
;       "es": "Alemania",
;       "fr": "Allemagne",
;       "ja": "????????",
;       "pt-BR": "Alemanha",
;       "ru": "????????",
;       "zh-CN": "??",
;       "de": "Deutschland",
;       "en": "Germany"
;     }
;   },
;   "traits": {
;     "ip_address": "149.250.207.170"
;   }
; }
; 
; 
Local $sContinentCode
Local $iContinentGeoname_id
Local $sContinentNamesJa
Local $sContinentNamesPt_BR
Local $sContinentNamesRu
Local $sContinentNamesZh_CN
Local $sContinentNamesDe
Local $sContinentNamesEn
Local $sContinentNamesEs
Local $sContinentNamesFr
Local $bCountryIs_in_european_union
Local $sCountryIso_code
Local $iCountryGeoname_id
Local $sCountryNamesFr
Local $sCountryNamesJa
Local $sCountryNamesPt_BR
Local $sCountryNamesRu
Local $sCountryNamesZh_CN
Local $sCountryNamesDe
Local $sCountryNamesEn
Local $sCountryNamesEs
Local $iMaxmindQueries_remaining
Local $bRegistered_countryIs_in_european_union
Local $sRegistered_countryIso_code
Local $iRegistered_countryGeoname_id
Local $sRegistered_countryNamesEs
Local $sRegistered_countryNamesFr
Local $sRegistered_countryNamesJa
Local $sRegistered_countryNamesPt_BR
Local $sRegistered_countryNamesRu
Local $sRegistered_countryNamesZh_CN
Local $sRegistered_countryNamesDe
Local $sRegistered_countryNamesEn
Local $sTraitsIp_address

$sContinentCode = $oJson.StringOf("continent.code")
$iContinentGeoname_id = $oJson.IntOf("continent.geoname_id")
$sContinentNamesJa = $oJson.StringOf("continent.names.ja")
$sContinentNamesPt_BR = $oJson.StringOf("continent.names.pt-BR")
$sContinentNamesRu = $oJson.StringOf("continent.names.ru")
$sContinentNamesZh_CN = $oJson.StringOf("continent.names.zh-CN")
$sContinentNamesDe = $oJson.StringOf("continent.names.de")
$sContinentNamesEn = $oJson.StringOf("continent.names.en")
$sContinentNamesEs = $oJson.StringOf("continent.names.es")
$sContinentNamesFr = $oJson.StringOf("continent.names.fr")
$bCountryIs_in_european_union = $oJson.BoolOf("country.is_in_european_union")
$sCountryIso_code = $oJson.StringOf("country.iso_code")
$iCountryGeoname_id = $oJson.IntOf("country.geoname_id")
$sCountryNamesFr = $oJson.StringOf("country.names.fr")
$sCountryNamesJa = $oJson.StringOf("country.names.ja")
$sCountryNamesPt_BR = $oJson.StringOf("country.names.pt-BR")
$sCountryNamesRu = $oJson.StringOf("country.names.ru")
$sCountryNamesZh_CN = $oJson.StringOf("country.names.zh-CN")
$sCountryNamesDe = $oJson.StringOf("country.names.de")
$sCountryNamesEn = $oJson.StringOf("country.names.en")
$sCountryNamesEs = $oJson.StringOf("country.names.es")
$iMaxmindQueries_remaining = $oJson.IntOf("maxmind.queries_remaining")
$bRegistered_countryIs_in_european_union = $oJson.BoolOf("registered_country.is_in_european_union")
$sRegistered_countryIso_code = $oJson.StringOf("registered_country.iso_code")
$iRegistered_countryGeoname_id = $oJson.IntOf("registered_country.geoname_id")
$sRegistered_countryNamesEs = $oJson.StringOf("registered_country.names.es")
$sRegistered_countryNamesFr = $oJson.StringOf("registered_country.names.fr")
$sRegistered_countryNamesJa = $oJson.StringOf("registered_country.names.ja")
$sRegistered_countryNamesPt_BR = $oJson.StringOf("registered_country.names.pt-BR")
$sRegistered_countryNamesRu = $oJson.StringOf("registered_country.names.ru")
$sRegistered_countryNamesZh_CN = $oJson.StringOf("registered_country.names.zh-CN")
$sRegistered_countryNamesDe = $oJson.StringOf("registered_country.names.de")
$sRegistered_countryNamesEn = $oJson.StringOf("registered_country.names.en")
$sTraitsIp_address = $oJson.StringOf("traits.ip_address")

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.