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

PowerBuilder 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
Cloud Signature CSC
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
Secrets
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

 

 

 

(PowerBuilder) 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

integer li_rc
oleobject loo_Http
string ls_JsonStr
oleobject loo_Json
integer li_Success
string ls_ContinentCode
integer li_ContinentGeoname_id
string ls_ContinentNamesJa
string ls_ContinentNamesPt_BR
string ls_ContinentNamesRu
string ls_ContinentNamesZh_CN
string ls_ContinentNamesDe
string ls_ContinentNamesEn
string ls_ContinentNamesEs
string ls_ContinentNamesFr
integer li_CountryIs_in_european_union
string ls_CountryIso_code
integer li_CountryGeoname_id
string ls_CountryNamesFr
string ls_CountryNamesJa
string ls_CountryNamesPt_BR
string ls_CountryNamesRu
string ls_CountryNamesZh_CN
string ls_CountryNamesDe
string ls_CountryNamesEn
string ls_CountryNamesEs
integer li_MaxmindQueries_remaining
integer li_Registered_countryIs_in_european_union
string ls_Registered_countryIso_code
integer li_Registered_countryGeoname_id
string ls_Registered_countryNamesEs
string ls_Registered_countryNamesFr
string ls_Registered_countryNamesJa
string ls_Registered_countryNamesPt_BR
string ls_Registered_countryNamesRu
string ls_Registered_countryNamesZh_CN
string ls_Registered_countryNamesDe
string ls_Registered_countryNamesEn
string ls_TraitsIp_address

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.Login = "MAXMIND_ACCOUNT_ID"
loo_Http.Password = "MAXMIND_LICENSE_KEY"
loo_Http.Accept = "application/json"

// Lookup an IPv4 address: 149.250.207.170  (this was a randomly chosen address)
ls_JsonStr = loo_Http.QuickGetStr("https://geoip.maxmind.com/geoip/v2.1/country/149.250.207.170")
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    return
end if

loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Json.EmitCompact = 0
li_Success = loo_Json.Load(ls_JsonStr)

Write-Debug loo_Json.Emit()

// 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"
//   }
// }
// 
// 

ls_ContinentCode = loo_Json.StringOf("continent.code")
li_ContinentGeoname_id = loo_Json.IntOf("continent.geoname_id")
ls_ContinentNamesJa = loo_Json.StringOf("continent.names.ja")
ls_ContinentNamesPt_BR = loo_Json.StringOf("continent.names.pt-BR")
ls_ContinentNamesRu = loo_Json.StringOf("continent.names.ru")
ls_ContinentNamesZh_CN = loo_Json.StringOf("continent.names.zh-CN")
ls_ContinentNamesDe = loo_Json.StringOf("continent.names.de")
ls_ContinentNamesEn = loo_Json.StringOf("continent.names.en")
ls_ContinentNamesEs = loo_Json.StringOf("continent.names.es")
ls_ContinentNamesFr = loo_Json.StringOf("continent.names.fr")
li_CountryIs_in_european_union = loo_Json.BoolOf("country.is_in_european_union")
ls_CountryIso_code = loo_Json.StringOf("country.iso_code")
li_CountryGeoname_id = loo_Json.IntOf("country.geoname_id")
ls_CountryNamesFr = loo_Json.StringOf("country.names.fr")
ls_CountryNamesJa = loo_Json.StringOf("country.names.ja")
ls_CountryNamesPt_BR = loo_Json.StringOf("country.names.pt-BR")
ls_CountryNamesRu = loo_Json.StringOf("country.names.ru")
ls_CountryNamesZh_CN = loo_Json.StringOf("country.names.zh-CN")
ls_CountryNamesDe = loo_Json.StringOf("country.names.de")
ls_CountryNamesEn = loo_Json.StringOf("country.names.en")
ls_CountryNamesEs = loo_Json.StringOf("country.names.es")
li_MaxmindQueries_remaining = loo_Json.IntOf("maxmind.queries_remaining")
li_Registered_countryIs_in_european_union = loo_Json.BoolOf("registered_country.is_in_european_union")
ls_Registered_countryIso_code = loo_Json.StringOf("registered_country.iso_code")
li_Registered_countryGeoname_id = loo_Json.IntOf("registered_country.geoname_id")
ls_Registered_countryNamesEs = loo_Json.StringOf("registered_country.names.es")
ls_Registered_countryNamesFr = loo_Json.StringOf("registered_country.names.fr")
ls_Registered_countryNamesJa = loo_Json.StringOf("registered_country.names.ja")
ls_Registered_countryNamesPt_BR = loo_Json.StringOf("registered_country.names.pt-BR")
ls_Registered_countryNamesRu = loo_Json.StringOf("registered_country.names.ru")
ls_Registered_countryNamesZh_CN = loo_Json.StringOf("registered_country.names.zh-CN")
ls_Registered_countryNamesDe = loo_Json.StringOf("registered_country.names.de")
ls_Registered_countryNamesEn = loo_Json.StringOf("registered_country.names.en")
ls_TraitsIp_address = loo_Json.StringOf("traits.ip_address")


destroy loo_Http
destroy loo_Json

 

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