Sample code for 30+ languages & platforms
Lianja Requires Chilkat v11.0.0+

RDAP Domain Lookup using rdap.org

See more HTTP Misc Examples

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

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

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

loHttp = createobject("CkHttp")

//  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"
loSbResponse = createobject("CkStringBuilder")
llSuccess = loHttp.QuickGetSb("https://rdap.org/domain/oracle.com",loSbResponse)
if (llSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loSbResponse
    return
endif

lnStatusCode = loHttp.LastStatus
if (lnStatusCode <> 200) then
    ? "Error response:"
    ? loSbResponse.GetAsString()
    ? "status code: " + str(lnStatusCode)
    release loHttp
    release loSbResponse
    return
endif

//  Load the JSON response and examine..

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

loJson = createobject("CkJsonObject")
loJson.LoadSb(loSbResponse)
loJson.EmitCompact = .F.
? loJson.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"
//          }
//        ]
//      }
//    ]
//  }

loJson1 = createobject("CkJsonObject")

lcObjectClassName = loJson.StringOf("objectClassName")
lcHandle = loJson.StringOf("handle")
lcLdhName = loJson.StringOf("ldhName")
llDelegationSigned = loJson.BoolOf("secureDNS.delegationSigned")
i = 0
lnCount_i = loJson.SizeOfArray("links")
do while i < lnCount_i
    loJson.I = i
    lcValue = loJson.StringOf("links[i].value")
    lcRel = loJson.StringOf("links[i].rel")
    lcHref = loJson.StringOf("links[i].href")
    lcV_type = loJson.StringOf("links[i].type")
    i = i + 1
enddo
i = 0
lnCount_i = loJson.SizeOfArray("status")
do while i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("status[i]")
    i = i + 1
enddo
i = 0
lnCount_i = loJson.SizeOfArray("entities")
do while i < lnCount_i
    loJson.I = i
    lcObjectClassName = loJson.StringOf("entities[i].objectClassName")
    lcHandle = loJson.StringOf("entities[i].handle")
    j = 0
    lnCount_j = loJson.SizeOfArray("entities[i].roles")
    do while j < lnCount_j
        loJson.J = j
        lcStrVal = loJson.StringOf("entities[i].roles[j]")
        j = j + 1
    enddo
    j = 0
    lnCount_j = loJson.SizeOfArray("entities[i].publicIds")
    do while j < lnCount_j
        loJson.J = j
        lcV_type = loJson.StringOf("entities[i].publicIds[j].type")
        lcIdentifier = loJson.StringOf("entities[i].publicIds[j].identifier")
        j = j + 1
    enddo
    j = 0
    lnCount_j = loJson.SizeOfArray("entities[i].vcardArray")
    do while j < lnCount_j
        loJson.J = j
        lcStrVal = loJson.StringOf("entities[i].vcardArray[j]")
        k = 0
        lnCount_k = loJson.SizeOfArray("entities[i].vcardArray[j]")
        do while k < lnCount_k
            loJson.K = k
            loJson.ObjectOf2("entities[i].vcardArray[j][k]",loJson1)

            lnI1 = 0
            lnCount_i1 = loJson1.SizeOfArray("")
            do while lnI1 < lnCount_i1
                loJson1.I = lnI1
                lcStrVal = loJson1.StringOf("[i]")
                lnI1 = lnI1 + 1
            enddo
            k = k + 1
        enddo
        j = j + 1
    enddo
    j = 0
    lnCount_j = loJson.SizeOfArray("entities[i].entities")
    do while j < lnCount_j
        loJson.J = j
        lcObjectClassName = loJson.StringOf("entities[i].entities[j].objectClassName")
        k = 0
        lnCount_k = loJson.SizeOfArray("entities[i].entities[j].roles")
        do while k < lnCount_k
            loJson.K = k
            lcStrVal = loJson.StringOf("entities[i].entities[j].roles[k]")
            k = k + 1
        enddo
        k = 0
        lnCount_k = loJson.SizeOfArray("entities[i].entities[j].vcardArray")
        do while k < lnCount_k
            loJson.K = k
            lcStrVal = loJson.StringOf("entities[i].entities[j].vcardArray[k]")
            loJson.ObjectOf2("entities[i].entities[j].vcardArray[k]",loJson1)

            lnI1 = 0
            lnCount_i1 = loJson1.SizeOfArray("")
            do while lnI1 < lnCount_i1
                loJson1.I = lnI1
                lnJ1 = 0
                lnCount_j1 = loJson1.SizeOfArray("[i]")
                do while lnJ1 < lnCount_j1
                    loJson1.J = lnJ1
                    lcStrVal = loJson1.StringOf("[i][j]")
                    lnJ1 = lnJ1 + 1
                enddo
                lnI1 = lnI1 + 1
            enddo
            k = k + 1
        enddo
        j = j + 1
    enddo
    i = i + 1
enddo
i = 0
lnCount_i = loJson.SizeOfArray("events")
do while i < lnCount_i
    loJson.I = i
    lcEventAction = loJson.StringOf("events[i].eventAction")
    lcEventDate = loJson.StringOf("events[i].eventDate")
    i = i + 1
enddo
i = 0
lnCount_i = loJson.SizeOfArray("nameservers")
do while i < lnCount_i
    loJson.I = i
    lcObjectClassName = loJson.StringOf("nameservers[i].objectClassName")
    lcLdhName = loJson.StringOf("nameservers[i].ldhName")
    i = i + 1
enddo
i = 0
lnCount_i = loJson.SizeOfArray("rdapConformance")
do while i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("rdapConformance[i]")
    i = i + 1
enddo
i = 0
lnCount_i = loJson.SizeOfArray("notices")
do while i < lnCount_i
    loJson.I = i
    lcTitle = loJson.StringOf("notices[i].title")
    j = 0
    lnCount_j = loJson.SizeOfArray("notices[i].description")
    do while j < lnCount_j
        loJson.J = j
        lcStrVal = loJson.StringOf("notices[i].description[j]")
        j = j + 1
    enddo
    j = 0
    lnCount_j = loJson.SizeOfArray("notices[i].links")
    do while j < lnCount_j
        loJson.J = j
        lcHref = loJson.StringOf("notices[i].links[j].href")
        lcV_type = loJson.StringOf("notices[i].links[j].type")
        j = j + 1
    enddo
    i = i + 1
enddo


release loHttp
release loSbResponse
release loJson
release loJson1