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

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

 

 

 

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

integer li_rc
oleobject loo_Http
string ls_JsonStr
oleobject loo_Json
integer li_Success
string ls_Ip
integer li_Is_eu
string ls_City
string ls_Region
string ls_Region_code
string ls_Country_name
string ls_Country_code
string ls_Continent_name
string ls_Continent_code
string ls_Latitude
string ls_Longitude
string ls_Asn
string ls_Organisation
string ls_Postal
string ls_Calling_code
string ls_Flag
string ls_Emoji_flag
string ls_Emoji_unicode
string ls_CurrencyName
string ls_CurrencyCode
string ls_CurrencySymbol
string ls_CurrencyNative
string ls_CurrencyPlural
string ls_Time_zoneName
string ls_Time_zoneAbbr
string ls_Time_zoneOffset
integer li_Time_zoneIs_dst
string ls_Time_zoneCurrent_time
integer li_ThreatIs_tor
integer li_ThreatIs_proxy
integer li_ThreatIs_anonymous
integer li_ThreatIs_known_attacker
integer li_ThreatIs_known_abuser
integer li_ThreatIs_threat
integer li_ThreatIs_bogon
string ls_Count
integer i
integer li_Count_i
string ls_Name
string ls_Native

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

ls_JsonStr = loo_Http.QuickGetStr("https://api.ipdata.co/149.250.207.170?api-key=MY_API_KEY")
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    return
end if

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.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

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

ls_Ip = loo_Json.StringOf("ip")
li_Is_eu = loo_Json.BoolOf("is_eu")
ls_City = loo_Json.StringOf("city")
ls_Region = loo_Json.StringOf("region")
ls_Region_code = loo_Json.StringOf("region_code")
ls_Country_name = loo_Json.StringOf("country_name")
ls_Country_code = loo_Json.StringOf("country_code")
ls_Continent_name = loo_Json.StringOf("continent_name")
ls_Continent_code = loo_Json.StringOf("continent_code")
ls_Latitude = loo_Json.StringOf("latitude")
ls_Longitude = loo_Json.StringOf("longitude")
ls_Asn = loo_Json.StringOf("asn")
ls_Organisation = loo_Json.StringOf("organisation")
ls_Postal = loo_Json.StringOf("postal")
ls_Calling_code = loo_Json.StringOf("calling_code")
ls_Flag = loo_Json.StringOf("flag")
ls_Emoji_flag = loo_Json.StringOf("emoji_flag")
ls_Emoji_unicode = loo_Json.StringOf("emoji_unicode")
ls_CurrencyName = loo_Json.StringOf("currency.name")
ls_CurrencyCode = loo_Json.StringOf("currency.code")
ls_CurrencySymbol = loo_Json.StringOf("currency.symbol")
ls_CurrencyNative = loo_Json.StringOf("currency.native")
ls_CurrencyPlural = loo_Json.StringOf("currency.plural")
ls_Time_zoneName = loo_Json.StringOf("time_zone.name")
ls_Time_zoneAbbr = loo_Json.StringOf("time_zone.abbr")
ls_Time_zoneOffset = loo_Json.StringOf("time_zone.offset")
li_Time_zoneIs_dst = loo_Json.BoolOf("time_zone.is_dst")
ls_Time_zoneCurrent_time = loo_Json.StringOf("time_zone.current_time")
li_ThreatIs_tor = loo_Json.BoolOf("threat.is_tor")
li_ThreatIs_proxy = loo_Json.BoolOf("threat.is_proxy")
li_ThreatIs_anonymous = loo_Json.BoolOf("threat.is_anonymous")
li_ThreatIs_known_attacker = loo_Json.BoolOf("threat.is_known_attacker")
li_ThreatIs_known_abuser = loo_Json.BoolOf("threat.is_known_abuser")
li_ThreatIs_threat = loo_Json.BoolOf("threat.is_threat")
li_ThreatIs_bogon = loo_Json.BoolOf("threat.is_bogon")
ls_Count = loo_Json.StringOf("count")
i = 0
li_Count_i = loo_Json.SizeOfArray("languages")
do while i < li_Count_i
    loo_Json.I = i
    ls_Name = loo_Json.StringOf("languages[i].name")
    ls_Native = loo_Json.StringOf("languages[i].native")
    i = i + 1
loop


destroy loo_Http
destroy loo_Json

 

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