Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Visual FoxPro Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
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
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(Visual FoxPro) 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

LOCAL loHttp
LOCAL lcJsonStr
LOCAL loJson
LOCAL lnSuccess
LOCAL lcContinentCode
LOCAL lnContinentGeoname_id
LOCAL lcContinentNamesJa
LOCAL lcContinentNamesPt_BR
LOCAL lcContinentNamesRu
LOCAL lcContinentNamesZh_CN
LOCAL lcContinentNamesDe
LOCAL lcContinentNamesEn
LOCAL lcContinentNamesEs
LOCAL lcContinentNamesFr
LOCAL lnCountryIs_in_european_union
LOCAL lcCountryIso_code
LOCAL lnCountryGeoname_id
LOCAL lcCountryNamesFr
LOCAL lcCountryNamesJa
LOCAL lcCountryNamesPt_BR
LOCAL lcCountryNamesRu
LOCAL lcCountryNamesZh_CN
LOCAL lcCountryNamesDe
LOCAL lcCountryNamesEn
LOCAL lcCountryNamesEs
LOCAL lnMaxmindQueries_remaining
LOCAL lnRegistered_countryIs_in_european_union
LOCAL lcRegistered_countryIso_code
LOCAL lnRegistered_countryGeoname_id
LOCAL lcRegistered_countryNamesEs
LOCAL lcRegistered_countryNamesFr
LOCAL lcRegistered_countryNamesJa
LOCAL lcRegistered_countryNamesPt_BR
LOCAL lcRegistered_countryNamesRu
LOCAL lcRegistered_countryNamesZh_CN
LOCAL lcRegistered_countryNamesDe
LOCAL lcRegistered_countryNamesEn
LOCAL lcTraitsIp_address

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

loHttp = CreateObject('Chilkat_9_5_0.Http')

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

* Lookup an IPv4 address: 149.250.207.170  (this was a randomly chosen address)
lcJsonStr = loHttp.QuickGetStr("https://geoip.maxmind.com/geoip/v2.1/country/149.250.207.170")
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    CANCEL
ENDIF

loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.EmitCompact = 0
lnSuccess = loJson.Load(lcJsonStr)

? loJson.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"
*   }
* }
* 
* 

lcContinentCode = loJson.StringOf("continent.code")
lnContinentGeoname_id = loJson.IntOf("continent.geoname_id")
lcContinentNamesJa = loJson.StringOf("continent.names.ja")
lcContinentNamesPt_BR = loJson.StringOf("continent.names.pt-BR")
lcContinentNamesRu = loJson.StringOf("continent.names.ru")
lcContinentNamesZh_CN = loJson.StringOf("continent.names.zh-CN")
lcContinentNamesDe = loJson.StringOf("continent.names.de")
lcContinentNamesEn = loJson.StringOf("continent.names.en")
lcContinentNamesEs = loJson.StringOf("continent.names.es")
lcContinentNamesFr = loJson.StringOf("continent.names.fr")
lnCountryIs_in_european_union = loJson.BoolOf("country.is_in_european_union")
lcCountryIso_code = loJson.StringOf("country.iso_code")
lnCountryGeoname_id = loJson.IntOf("country.geoname_id")
lcCountryNamesFr = loJson.StringOf("country.names.fr")
lcCountryNamesJa = loJson.StringOf("country.names.ja")
lcCountryNamesPt_BR = loJson.StringOf("country.names.pt-BR")
lcCountryNamesRu = loJson.StringOf("country.names.ru")
lcCountryNamesZh_CN = loJson.StringOf("country.names.zh-CN")
lcCountryNamesDe = loJson.StringOf("country.names.de")
lcCountryNamesEn = loJson.StringOf("country.names.en")
lcCountryNamesEs = loJson.StringOf("country.names.es")
lnMaxmindQueries_remaining = loJson.IntOf("maxmind.queries_remaining")
lnRegistered_countryIs_in_european_union = loJson.BoolOf("registered_country.is_in_european_union")
lcRegistered_countryIso_code = loJson.StringOf("registered_country.iso_code")
lnRegistered_countryGeoname_id = loJson.IntOf("registered_country.geoname_id")
lcRegistered_countryNamesEs = loJson.StringOf("registered_country.names.es")
lcRegistered_countryNamesFr = loJson.StringOf("registered_country.names.fr")
lcRegistered_countryNamesJa = loJson.StringOf("registered_country.names.ja")
lcRegistered_countryNamesPt_BR = loJson.StringOf("registered_country.names.pt-BR")
lcRegistered_countryNamesRu = loJson.StringOf("registered_country.names.ru")
lcRegistered_countryNamesZh_CN = loJson.StringOf("registered_country.names.zh-CN")
lcRegistered_countryNamesDe = loJson.StringOf("registered_country.names.de")
lcRegistered_countryNamesEn = loJson.StringOf("registered_country.names.en")
lcTraitsIp_address = loJson.StringOf("traits.ip_address")

RELEASE loHttp
RELEASE loJson


 

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