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

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

 

 

 

(DataFlex) ipdata.co IPv4 Geolocation Lookup

See more Geolocation Examples

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

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    String sJsonStr
    Handle hoJson
    Boolean iSuccess
    String sIp
    Boolean iIs_eu
    String sCity
    String sRegion
    String sRegion_code
    String sCountry_name
    String sCountry_code
    String sContinent_name
    String sContinent_code
    String sLatitude
    String sLongitude
    String sAsn
    String sOrganisation
    String sPostal
    String sCalling_code
    String sFlag
    String sEmoji_flag
    String sEmoji_unicode
    String sCurrencyName
    String sCurrencyCode
    String sCurrencySymbol
    String sCurrencyNative
    String sCurrencyPlural
    String sTime_zoneName
    String sTime_zoneAbbr
    String sTime_zoneOffset
    Boolean iTime_zoneIs_dst
    String sTime_zoneCurrent_time
    Boolean iThreatIs_tor
    Boolean iThreatIs_proxy
    Boolean iThreatIs_anonymous
    Boolean iThreatIs_known_attacker
    Boolean iThreatIs_known_abuser
    Boolean iThreatIs_threat
    Boolean iThreatIs_bogon
    String sCount
    Integer i
    Integer iCount_i
    String sName
    String sNative
    String sTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Get ComQuickGetStr Of hoHttp "https://api.ipdata.co/149.250.207.170?api-key=MY_API_KEY" To sJsonStr
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Set ComEmitCompact Of hoJson To False
    Get ComLoad Of hoJson sJsonStr To iSuccess

    Get ComEmit Of hoJson To sTemp1
    Showln sTemp1

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

    Get ComStringOf Of hoJson "ip" To sIp
    Get ComBoolOf Of hoJson "is_eu" To iIs_eu
    Get ComStringOf Of hoJson "city" To sCity
    Get ComStringOf Of hoJson "region" To sRegion
    Get ComStringOf Of hoJson "region_code" To sRegion_code
    Get ComStringOf Of hoJson "country_name" To sCountry_name
    Get ComStringOf Of hoJson "country_code" To sCountry_code
    Get ComStringOf Of hoJson "continent_name" To sContinent_name
    Get ComStringOf Of hoJson "continent_code" To sContinent_code
    Get ComStringOf Of hoJson "latitude" To sLatitude
    Get ComStringOf Of hoJson "longitude" To sLongitude
    Get ComStringOf Of hoJson "asn" To sAsn
    Get ComStringOf Of hoJson "organisation" To sOrganisation
    Get ComStringOf Of hoJson "postal" To sPostal
    Get ComStringOf Of hoJson "calling_code" To sCalling_code
    Get ComStringOf Of hoJson "flag" To sFlag
    Get ComStringOf Of hoJson "emoji_flag" To sEmoji_flag
    Get ComStringOf Of hoJson "emoji_unicode" To sEmoji_unicode
    Get ComStringOf Of hoJson "currency.name" To sCurrencyName
    Get ComStringOf Of hoJson "currency.code" To sCurrencyCode
    Get ComStringOf Of hoJson "currency.symbol" To sCurrencySymbol
    Get ComStringOf Of hoJson "currency.native" To sCurrencyNative
    Get ComStringOf Of hoJson "currency.plural" To sCurrencyPlural
    Get ComStringOf Of hoJson "time_zone.name" To sTime_zoneName
    Get ComStringOf Of hoJson "time_zone.abbr" To sTime_zoneAbbr
    Get ComStringOf Of hoJson "time_zone.offset" To sTime_zoneOffset
    Get ComBoolOf Of hoJson "time_zone.is_dst" To iTime_zoneIs_dst
    Get ComStringOf Of hoJson "time_zone.current_time" To sTime_zoneCurrent_time
    Get ComBoolOf Of hoJson "threat.is_tor" To iThreatIs_tor
    Get ComBoolOf Of hoJson "threat.is_proxy" To iThreatIs_proxy
    Get ComBoolOf Of hoJson "threat.is_anonymous" To iThreatIs_anonymous
    Get ComBoolOf Of hoJson "threat.is_known_attacker" To iThreatIs_known_attacker
    Get ComBoolOf Of hoJson "threat.is_known_abuser" To iThreatIs_known_abuser
    Get ComBoolOf Of hoJson "threat.is_threat" To iThreatIs_threat
    Get ComBoolOf Of hoJson "threat.is_bogon" To iThreatIs_bogon
    Get ComStringOf Of hoJson "count" To sCount
    Move 0 To i
    Get ComSizeOfArray Of hoJson "languages" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "languages[i].name" To sName
        Get ComStringOf Of hoJson "languages[i].native" To sNative
        Move (i + 1) To i
    Loop



End_Procedure

 

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