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) ipdata.co IPv4 Geolocation Lookup

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

LOCAL loHttp
LOCAL lcJsonStr
LOCAL loJson
LOCAL lnSuccess
LOCAL lcIp
LOCAL lnIs_eu
LOCAL lcCity
LOCAL lcRegion
LOCAL lcRegion_code
LOCAL lcCountry_name
LOCAL lcCountry_code
LOCAL lcContinent_name
LOCAL lcContinent_code
LOCAL lcLatitude
LOCAL lcLongitude
LOCAL lcAsn
LOCAL lcOrganisation
LOCAL lcPostal
LOCAL lcCalling_code
LOCAL lcFlag
LOCAL lcEmoji_flag
LOCAL lcEmoji_unicode
LOCAL lcCurrencyName
LOCAL lcCurrencyCode
LOCAL lcCurrencySymbol
LOCAL lcCurrencyNative
LOCAL lcCurrencyPlural
LOCAL lcTime_zoneName
LOCAL lcTime_zoneAbbr
LOCAL lcTime_zoneOffset
LOCAL lnTime_zoneIs_dst
LOCAL lcTime_zoneCurrent_time
LOCAL lnThreatIs_tor
LOCAL lnThreatIs_proxy
LOCAL lnThreatIs_anonymous
LOCAL lnThreatIs_known_attacker
LOCAL lnThreatIs_known_abuser
LOCAL lnThreatIs_threat
LOCAL lnThreatIs_bogon
LOCAL lcCount
LOCAL i
LOCAL lnCount_i
LOCAL lcName
LOCAL lcNative

* 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')

lcJsonStr = loHttp.QuickGetStr("https://api.ipdata.co/149.250.207.170?api-key=MY_API_KEY")
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

* {
*   "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"
* }

lcIp = loJson.StringOf("ip")
lnIs_eu = loJson.BoolOf("is_eu")
lcCity = loJson.StringOf("city")
lcRegion = loJson.StringOf("region")
lcRegion_code = loJson.StringOf("region_code")
lcCountry_name = loJson.StringOf("country_name")
lcCountry_code = loJson.StringOf("country_code")
lcContinent_name = loJson.StringOf("continent_name")
lcContinent_code = loJson.StringOf("continent_code")
lcLatitude = loJson.StringOf("latitude")
lcLongitude = loJson.StringOf("longitude")
lcAsn = loJson.StringOf("asn")
lcOrganisation = loJson.StringOf("organisation")
lcPostal = loJson.StringOf("postal")
lcCalling_code = loJson.StringOf("calling_code")
lcFlag = loJson.StringOf("flag")
lcEmoji_flag = loJson.StringOf("emoji_flag")
lcEmoji_unicode = loJson.StringOf("emoji_unicode")
lcCurrencyName = loJson.StringOf("currency.name")
lcCurrencyCode = loJson.StringOf("currency.code")
lcCurrencySymbol = loJson.StringOf("currency.symbol")
lcCurrencyNative = loJson.StringOf("currency.native")
lcCurrencyPlural = loJson.StringOf("currency.plural")
lcTime_zoneName = loJson.StringOf("time_zone.name")
lcTime_zoneAbbr = loJson.StringOf("time_zone.abbr")
lcTime_zoneOffset = loJson.StringOf("time_zone.offset")
lnTime_zoneIs_dst = loJson.BoolOf("time_zone.is_dst")
lcTime_zoneCurrent_time = loJson.StringOf("time_zone.current_time")
lnThreatIs_tor = loJson.BoolOf("threat.is_tor")
lnThreatIs_proxy = loJson.BoolOf("threat.is_proxy")
lnThreatIs_anonymous = loJson.BoolOf("threat.is_anonymous")
lnThreatIs_known_attacker = loJson.BoolOf("threat.is_known_attacker")
lnThreatIs_known_abuser = loJson.BoolOf("threat.is_known_abuser")
lnThreatIs_threat = loJson.BoolOf("threat.is_threat")
lnThreatIs_bogon = loJson.BoolOf("threat.is_bogon")
lcCount = loJson.StringOf("count")
i = 0
lnCount_i = loJson.SizeOfArray("languages")
DO WHILE i < lnCount_i
    loJson.I = i
    lcName = loJson.StringOf("languages[i].name")
    lcNative = loJson.StringOf("languages[i].native")
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loJson


 

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