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

Swift 3,4,5... 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

 

 

 

(Swift 3,4,5...) RDAP Domain Lookup using rdap.org

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

Chilkat Downloads for the Swift Programming Language

MAC OS X (Cocoa) Objective-C/Swift Libs

iOS Objective-C/Swift Libs

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

    let http = CkoHttp()!

    // 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"
    let sbResponse = CkoStringBuilder()!
    var success: Bool = http.quickGetSb("https://rdap.org/domain/oracle.com", sbContent: sbResponse)
    if success == false {
        print("\(http.lastErrorText!)")
        return
    }

    var statusCode: Int = http.lastStatus.intValue
    if statusCode != 200 {
        print("Error response:")
        print("\(sbResponse.getAsString()!)")
        print("status code: \(statusCode)")
        return
    }

    // Load the JSON response and examine..

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

    let json = CkoJsonObject()!
    json.loadSb(sbResponse)
    json.emitCompact = false
    print("\(json.emit()!)")

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

    var value: String?
    var rel: String?
    var href: String?
    var v_type: String?
    var strVal: String?
    var j: Int
    var count_j: Int
    var identifier: String?
    var k: Int
    var count_k: Int
    var json1: CkoJsonObject?
    var i1: Int
    var count_i1: Int
    var j1: Int
    var count_j1: Int
    var eventAction: String?
    var eventDate: String?
    var title: String?

    var objectClassName: String? = json.string(of: "objectClassName")
    var handle: String? = json.string(of: "handle")
    var ldhName: String? = json.string(of: "ldhName")
    var DelegationSigned: Bool = json.bool(of: "secureDNS.delegationSigned")
    var i: Int = 0
    var count_i: Int = json.size(ofArray: "links").intValue
    while i < count_i {
        json.i = i
        value = json.string(of: "links[i].value")
        rel = json.string(of: "links[i].rel")
        href = json.string(of: "links[i].href")
        v_type = json.string(of: "links[i].type")
        i = i + 1
    }

    i = 0
    count_i = json.size(ofArray: "status").intValue
    while i < count_i {
        json.i = i
        strVal = json.string(of: "status[i]")
        i = i + 1
    }

    i = 0
    count_i = json.size(ofArray: "entities").intValue
    while i < count_i {
        json.i = i
        objectClassName = json.string(of: "entities[i].objectClassName")
        handle = json.string(of: "entities[i].handle")
        j = 0
        count_j = json.size(ofArray: "entities[i].roles").intValue
        while j < count_j {
            json.j = j
            strVal = json.string(of: "entities[i].roles[j]")
            j = j + 1
        }

        j = 0
        count_j = json.size(ofArray: "entities[i].publicIds").intValue
        while j < count_j {
            json.j = j
            v_type = json.string(of: "entities[i].publicIds[j].type")
            identifier = json.string(of: "entities[i].publicIds[j].identifier")
            j = j + 1
        }

        j = 0
        count_j = json.size(ofArray: "entities[i].vcardArray").intValue
        while j < count_j {
            json.j = j
            strVal = json.string(of: "entities[i].vcardArray[j]")
            k = 0
            count_k = json.size(ofArray: "entities[i].vcardArray[j]").intValue
            while k < count_k {
                json.k = k

                json1 = json.object(of: "entities[i].vcardArray[j][k]")
                i1 = 0
                count_i1 = json1!.size(ofArray: "").intValue
                while i1 < count_i1 {
                    json1.i = i1
                    strVal = json1!.string(of: "[i]")
                    i1 = i1 + 1
                }

                json1 = nil
                k = k + 1
            }

            j = j + 1
        }

        j = 0
        count_j = json.size(ofArray: "entities[i].entities").intValue
        while j < count_j {
            json.j = j
            objectClassName = json.string(of: "entities[i].entities[j].objectClassName")
            k = 0
            count_k = json.size(ofArray: "entities[i].entities[j].roles").intValue
            while k < count_k {
                json.k = k
                strVal = json.string(of: "entities[i].entities[j].roles[k]")
                k = k + 1
            }

            k = 0
            count_k = json.size(ofArray: "entities[i].entities[j].vcardArray").intValue
            while k < count_k {
                json.k = k
                strVal = json.string(of: "entities[i].entities[j].vcardArray[k]")

                json1 = json.object(of: "entities[i].entities[j].vcardArray[k]")
                i1 = 0
                count_i1 = json1!.size(ofArray: "").intValue
                while i1 < count_i1 {
                    json1.i = i1
                    j1 = 0
                    count_j1 = json1!.size(ofArray: "[i]").intValue
                    while j1 < count_j1 {
                        json1.j = j1
                        strVal = json1!.string(of: "[i][j]")
                        j1 = j1 + 1
                    }

                    i1 = i1 + 1
                }

                json1 = nil
                k = k + 1
            }

            j = j + 1
        }

        i = i + 1
    }

    i = 0
    count_i = json.size(ofArray: "events").intValue
    while i < count_i {
        json.i = i
        eventAction = json.string(of: "events[i].eventAction")
        eventDate = json.string(of: "events[i].eventDate")
        i = i + 1
    }

    i = 0
    count_i = json.size(ofArray: "nameservers").intValue
    while i < count_i {
        json.i = i
        objectClassName = json.string(of: "nameservers[i].objectClassName")
        ldhName = json.string(of: "nameservers[i].ldhName")
        i = i + 1
    }

    i = 0
    count_i = json.size(ofArray: "rdapConformance").intValue
    while i < count_i {
        json.i = i
        strVal = json.string(of: "rdapConformance[i]")
        i = i + 1
    }

    i = 0
    count_i = json.size(ofArray: "notices").intValue
    while i < count_i {
        json.i = i
        title = json.string(of: "notices[i].title")
        j = 0
        count_j = json.size(ofArray: "notices[i].description").intValue
        while j < count_j {
            json.j = j
            strVal = json.string(of: "notices[i].description[j]")
            j = j + 1
        }

        j = 0
        count_j = json.size(ofArray: "notices[i].links").intValue
        while j < count_j {
            json.j = j
            href = json.string(of: "notices[i].links[j].href")
            v_type = json.string(of: "notices[i].links[j].type")
            j = j + 1
        }

        i = i + 1
    }


}

 

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