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

 

 

 

(DataFlex) RDAP Domain Lookup using rdap.org

Demonstrates doing an RDAP domain lookup using the rdap.org public RDAP server.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Variant vSbResponse
    Handle hoSbResponse
    Boolean iSuccess
    Integer iStatusCode
    Handle hoJson
    String sValue
    String sRel
    String sHref
    String sV_type
    String sStrVal
    Integer j
    Integer iCount_j
    String sIdentifier
    Integer k
    Integer iCount_k
    Variant vJson1
    Handle hoJson1
    Integer iI1
    Integer iCount_i1
    Integer iJ1
    Integer iCount_j1
    String sEventAction
    String sEventDate
    String sTitle
    String sObjectClassName
    String sHandle
    String sLdhName
    Boolean iDelegationSigned
    Integer i
    Integer iCount_i
    String sTemp1

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

    // Send HTTP requests to https://rdap.org/<type>/<object>, where <type> is the object type (one of domain, ip, autnum, entity etc)
    // and <object> is the object identifier (eg example.com, 192.168.0.1, 64496, etc).

    // For example, here's a lookup for "oracle.com"
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponse
    If (Not(IsComObjectCreated(hoSbResponse))) Begin
        Send CreateComObject of hoSbResponse
    End
    Get pvComObject of hoSbResponse to vSbResponse
    Get ComQuickGetSb Of hoHttp "https://rdap.org/domain/oracle.com" vSbResponse To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComLastStatus Of hoHttp To iStatusCode
    If (iStatusCode <> 200) Begin
        Showln "Error response:"
        Get ComGetAsString Of hoSbResponse To sTemp1
        Showln sTemp1
        Showln "status code: " iStatusCode
        Procedure_Return
    End

    // Load the JSON response and examine..

    // Use this online tool to generate parsing code from sample JSON: 
    // Generate Parsing Code from JSON

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get pvComObject of hoSbResponse to vSbResponse
    Get ComLoadSb Of hoJson vSbResponse To iSuccess
    Set ComEmitCompact Of hoJson To False
    Get ComEmit Of hoJson To sTemp1
    Showln sTemp1

    // Here's a sample response, and the parsing code generated from the above online tool follows..

    // {
    //   "objectClassName": "domain",
    //   "handle": "607513_DOMAIN_COM-VRSN",
    //   "ldhName": "ORACLE.COM",
    //   "links": [
    //     {
    //       "value": "https:\/\/rdap.verisign.com\/com\/v1\/domain\/ORACLE.COM",
    //       "rel": "self",
    //       "href": "https:\/\/rdap.verisign.com\/com\/v1\/domain\/ORACLE.COM",
    //       "type": "application\/rdap+json"
    //     },
    //     {
    //       "value": "https:\/\/rdap.markmonitor.com\/rdap\/domain\/ORACLE.COM",
    //       "rel": "related",
    //       "href": "https:\/\/rdap.markmonitor.com\/rdap\/domain\/ORACLE.COM",
    //       "type": "application\/rdap+json"
    //     }
    //   ],
    //   "status": [
    //     "client delete prohibited",
    //     "client transfer prohibited",
    //     "client update prohibited",
    //     "server delete prohibited",
    //     "server transfer prohibited",
    //     "server update prohibited"
    //   ],
    //   "entities": [
    //     {
    //       "objectClassName": "entity",
    //       "handle": "292",
    //       "roles": [
    //         "registrar"
    //       ],
    //       "publicIds": [
    //         {
    //           "type": "IANA Registrar ID",
    //           "identifier": "292"
    //         }
    //       ],
    //       "vcardArray": [
    //         "vcard",
    //         [
    //           [
    //             "version",
    //             {},
    //             "text",
    //             "4.0"
    //           ],
    //           [
    //             "fn",
    //             {},
    //             "text",
    //             "MarkMonitor Inc."
    //           ]
    //         ]
    //       ],
    //       "entities": [
    //         {
    //           "objectClassName": "entity",
    //           "roles": [
    //             "abuse"
    //           ],
    //           "vcardArray": [
    //             "vcard",
    //             [
    //               [
    //                 "version",
    //                 {},
    //                 "text",
    //                 "4.0"
    //               ],
    //               [
    //                 "fn",
    //                 {},
    //                 "text",
    //                 ""
    //               ],
    //               [
    //                 "tel",
    //                 {
    //                   "type": "voice"
    //                 },
    //                 "uri",
    //                 "tel:+1.2086851750"
    //               ],
    //               [
    //                 "email",
    //                 {},
    //                 "text",
    //                 "abusecomplaints@markmonitor.com"
    //               ]
    //             ]
    //           ]
    //         }
    //       ]
    //     }
    //   ],
    //   "events": [
    //     {
    //       "eventAction": "registration",
    //       "eventDate": "1988-12-02T05:00:00Z"
    //     },
    //     {
    //       "eventAction": "expiration",
    //       "eventDate": "2025-12-01T05:00:00Z"
    //     },
    //     {
    //       "eventAction": "last changed",
    //       "eventDate": "2024-10-30T09:32:52Z"
    //     },
    //     {
    //       "eventAction": "last update of RDAP database",
    //       "eventDate": "2024-11-26T14:11:14Z"
    //     }
    //   ],
    //   "secureDNS": {
    //     "delegationSigned": false
    //   },
    //   "nameservers": [
    //     {
    //       "objectClassName": "nameserver",
    //       "ldhName": "A1-160.AKAM.NET"
    //     },
    //     {
    //       "objectClassName": "nameserver",
    //       "ldhName": "A11-66.AKAM.NET"
    //     },
    //     {
    //       "objectClassName": "nameserver",
    //       "ldhName": "A13-65.AKAM.NET"
    //     },
    //     {
    //       "objectClassName": "nameserver",
    //       "ldhName": "A18-67.AKAM.NET"
    //     },
    //     {
    //       "objectClassName": "nameserver",
    //       "ldhName": "NS1.P201.DNS.ORACLECLOUD.NET"
    //     },
    //     {
    //       "objectClassName": "nameserver",
    //       "ldhName": "NS2.P201.DNS.ORACLECLOUD.NET"
    //     },
    //     {
    //       "objectClassName": "nameserver",
    //       "ldhName": "NS3.P201.DNS.ORACLECLOUD.NET"
    //     },
    //     {
    //       "objectClassName": "nameserver",
    //       "ldhName": "NS4.P201.DNS.ORACLECLOUD.NET"
    //     }
    //   ],
    //   "rdapConformance": [
    //     "rdap_level_0",
    //     "icann_rdap_technical_implementation_guide_0",
    //     "icann_rdap_response_profile_0"
    //   ],
    //   "notices": [
    //     {
    //       "title": "Terms of Use",
    //       "description": [
    //         "Service subject to Terms of Use."
    //       ],
    //       "links": [
    //         {
    //           "href": "https:\/\/www.verisign.com\/domain-names\/registration-data-access-protocol\/terms-service\/index.xhtml",
    //           "type": "text\/html"
    //         }
    //       ]
    //     },
    //     {
    //       "title": "Status Codes",
    //       "description": [
    //         "For more information on domain status codes, please visit https:\/\/icann.org\/epp"
    //       ],
    //       "links": [
    //         {
    //           "href": "https:\/\/icann.org\/epp",
    //           "type": "text\/html"
    //         }
    //       ]
    //     },
    //     {
    //       "title": "RDDS Inaccuracy Complaint Form",
    //       "description": [
    //         "URL of the ICANN RDDS Inaccuracy Complaint Form: https:\/\/icann.org\/wicf"
    //       ],
    //       "links": [
    //         {
    //           "href": "https:\/\/icann.org\/wicf",
    //           "type": "text\/html"
    //         }
    //       ]
    //     }
    //   ]
    // }

    Get ComStringOf Of hoJson "objectClassName" To sObjectClassName
    Get ComStringOf Of hoJson "handle" To sHandle
    Get ComStringOf Of hoJson "ldhName" To sLdhName
    Get ComBoolOf Of hoJson "secureDNS.delegationSigned" To iDelegationSigned
    Move 0 To i
    Get ComSizeOfArray Of hoJson "links" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "links[i].value" To sValue
        Get ComStringOf Of hoJson "links[i].rel" To sRel
        Get ComStringOf Of hoJson "links[i].href" To sHref
        Get ComStringOf Of hoJson "links[i].type" To sV_type
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "status" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "status[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "entities" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "entities[i].objectClassName" To sObjectClassName
        Get ComStringOf Of hoJson "entities[i].handle" To sHandle
        Move 0 To j
        Get ComSizeOfArray Of hoJson "entities[i].roles" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "entities[i].roles[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "entities[i].publicIds" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "entities[i].publicIds[j].type" To sV_type
            Get ComStringOf Of hoJson "entities[i].publicIds[j].identifier" To sIdentifier
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "entities[i].vcardArray" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "entities[i].vcardArray[j]" To sStrVal
            Move 0 To k
            Get ComSizeOfArray Of hoJson "entities[i].vcardArray[j]" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJson To k

                Get ComObjectOf Of hoJson "entities[i].vcardArray[j][k]" To vJson1
                If (IsComObject(vJson1)) Begin
                    Get Create (RefClass(cComChilkatJsonObject)) To hoJson1
                    Set pvComObject Of hoJson1 To vJson1
                End
                Move 0 To iI1
                Get ComSizeOfArray Of hoJson1 "" To iCount_i1
                While (iI1 < iCount_i1)
                    Set ComI Of hoJson1 To iI1
                    Get ComStringOf Of hoJson1 "[i]" To sStrVal
                    Move (iI1 + 1) To iI1
                Loop

                Send Destroy of hoJson1
                Move (k + 1) To k
            Loop

            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "entities[i].entities" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "entities[i].entities[j].objectClassName" To sObjectClassName
            Move 0 To k
            Get ComSizeOfArray Of hoJson "entities[i].entities[j].roles" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJson To k
                Get ComStringOf Of hoJson "entities[i].entities[j].roles[k]" To sStrVal
                Move (k + 1) To k
            Loop

            Move 0 To k
            Get ComSizeOfArray Of hoJson "entities[i].entities[j].vcardArray" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJson To k
                Get ComStringOf Of hoJson "entities[i].entities[j].vcardArray[k]" To sStrVal

                Get ComObjectOf Of hoJson "entities[i].entities[j].vcardArray[k]" To vJson1
                If (IsComObject(vJson1)) Begin
                    Get Create (RefClass(cComChilkatJsonObject)) To hoJson1
                    Set pvComObject Of hoJson1 To vJson1
                End
                Move 0 To iI1
                Get ComSizeOfArray Of hoJson1 "" To iCount_i1
                While (iI1 < iCount_i1)
                    Set ComI Of hoJson1 To iI1
                    Move 0 To iJ1
                    Get ComSizeOfArray Of hoJson1 "[i]" To iCount_j1
                    While (iJ1 < iCount_j1)
                        Set ComJ Of hoJson1 To iJ1
                        Get ComStringOf Of hoJson1 "[i][j]" To sStrVal
                        Move (iJ1 + 1) To iJ1
                    Loop

                    Move (iI1 + 1) To iI1
                Loop

                Send Destroy of hoJson1
                Move (k + 1) To k
            Loop

            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "events" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "events[i].eventAction" To sEventAction
        Get ComStringOf Of hoJson "events[i].eventDate" To sEventDate
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "nameservers" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "nameservers[i].objectClassName" To sObjectClassName
        Get ComStringOf Of hoJson "nameservers[i].ldhName" To sLdhName
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "rdapConformance" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "rdapConformance[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "notices" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "notices[i].title" To sTitle
        Move 0 To j
        Get ComSizeOfArray Of hoJson "notices[i].description" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "notices[i].description[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "notices[i].links" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "notices[i].links[j].href" To sHref
            Get ComStringOf Of hoJson "notices[i].links[j].type" To sV_type
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop



End_Procedure

 

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