Unicode C++
Unicode C++
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 Unicode C++ Downloads
#include <CkHttpW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
bool success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttpW http;
// 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"
CkStringBuilderW sbResponse;
success = http.QuickGetSb(L"https://rdap.org/domain/oracle.com",sbResponse);
if (success == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
int statusCode = http.get_LastStatus();
if (statusCode != 200) {
wprintf(L"Error response:\n");
wprintf(L"%s\n",sbResponse.getAsString());
wprintf(L"status code: %d\n",statusCode);
return;
}
// Load the JSON response and examine..
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
CkJsonObjectW json;
json.LoadSb(sbResponse);
json.put_EmitCompact(false);
wprintf(L"%s\n",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"
// }
// ]
// }
// ]
// }
const wchar_t *value = 0;
const wchar_t *rel = 0;
const wchar_t *href = 0;
const wchar_t *v_type = 0;
const wchar_t *strVal = 0;
int j;
int count_j;
const wchar_t *identifier = 0;
int k;
int count_k;
CkJsonObjectW json1;
int i1;
int count_i1;
int j1;
int count_j1;
const wchar_t *eventAction = 0;
const wchar_t *eventDate = 0;
const wchar_t *title = 0;
const wchar_t *objectClassName = json.stringOf(L"objectClassName");
const wchar_t *handle = json.stringOf(L"handle");
const wchar_t *ldhName = json.stringOf(L"ldhName");
bool DelegationSigned = json.BoolOf(L"secureDNS.delegationSigned");
int i = 0;
int count_i = json.SizeOfArray(L"links");
while (i < count_i) {
json.put_I(i);
value = json.stringOf(L"links[i].value");
rel = json.stringOf(L"links[i].rel");
href = json.stringOf(L"links[i].href");
v_type = json.stringOf(L"links[i].type");
i = i + 1;
}
i = 0;
count_i = json.SizeOfArray(L"status");
while (i < count_i) {
json.put_I(i);
strVal = json.stringOf(L"status[i]");
i = i + 1;
}
i = 0;
count_i = json.SizeOfArray(L"entities");
while (i < count_i) {
json.put_I(i);
objectClassName = json.stringOf(L"entities[i].objectClassName");
handle = json.stringOf(L"entities[i].handle");
j = 0;
count_j = json.SizeOfArray(L"entities[i].roles");
while (j < count_j) {
json.put_J(j);
strVal = json.stringOf(L"entities[i].roles[j]");
j = j + 1;
}
j = 0;
count_j = json.SizeOfArray(L"entities[i].publicIds");
while (j < count_j) {
json.put_J(j);
v_type = json.stringOf(L"entities[i].publicIds[j].type");
identifier = json.stringOf(L"entities[i].publicIds[j].identifier");
j = j + 1;
}
j = 0;
count_j = json.SizeOfArray(L"entities[i].vcardArray");
while (j < count_j) {
json.put_J(j);
strVal = json.stringOf(L"entities[i].vcardArray[j]");
k = 0;
count_k = json.SizeOfArray(L"entities[i].vcardArray[j]");
while (k < count_k) {
json.put_K(k);
json.ObjectOf2(L"entities[i].vcardArray[j][k]",json1);
i1 = 0;
count_i1 = json1.SizeOfArray(L"");
while (i1 < count_i1) {
json1.put_I(i1);
strVal = json1.stringOf(L"[i]");
i1 = i1 + 1;
}
k = k + 1;
}
j = j + 1;
}
j = 0;
count_j = json.SizeOfArray(L"entities[i].entities");
while (j < count_j) {
json.put_J(j);
objectClassName = json.stringOf(L"entities[i].entities[j].objectClassName");
k = 0;
count_k = json.SizeOfArray(L"entities[i].entities[j].roles");
while (k < count_k) {
json.put_K(k);
strVal = json.stringOf(L"entities[i].entities[j].roles[k]");
k = k + 1;
}
k = 0;
count_k = json.SizeOfArray(L"entities[i].entities[j].vcardArray");
while (k < count_k) {
json.put_K(k);
strVal = json.stringOf(L"entities[i].entities[j].vcardArray[k]");
json.ObjectOf2(L"entities[i].entities[j].vcardArray[k]",json1);
i1 = 0;
count_i1 = json1.SizeOfArray(L"");
while (i1 < count_i1) {
json1.put_I(i1);
j1 = 0;
count_j1 = json1.SizeOfArray(L"[i]");
while (j1 < count_j1) {
json1.put_J(j1);
strVal = json1.stringOf(L"[i][j]");
j1 = j1 + 1;
}
i1 = i1 + 1;
}
k = k + 1;
}
j = j + 1;
}
i = i + 1;
}
i = 0;
count_i = json.SizeOfArray(L"events");
while (i < count_i) {
json.put_I(i);
eventAction = json.stringOf(L"events[i].eventAction");
eventDate = json.stringOf(L"events[i].eventDate");
i = i + 1;
}
i = 0;
count_i = json.SizeOfArray(L"nameservers");
while (i < count_i) {
json.put_I(i);
objectClassName = json.stringOf(L"nameservers[i].objectClassName");
ldhName = json.stringOf(L"nameservers[i].ldhName");
i = i + 1;
}
i = 0;
count_i = json.SizeOfArray(L"rdapConformance");
while (i < count_i) {
json.put_I(i);
strVal = json.stringOf(L"rdapConformance[i]");
i = i + 1;
}
i = 0;
count_i = json.SizeOfArray(L"notices");
while (i < count_i) {
json.put_I(i);
title = json.stringOf(L"notices[i].title");
j = 0;
count_j = json.SizeOfArray(L"notices[i].description");
while (j < count_j) {
json.put_J(j);
strVal = json.stringOf(L"notices[i].description[j]");
j = j + 1;
}
j = 0;
count_j = json.SizeOfArray(L"notices[i].links");
while (j < count_j) {
json.put_J(j);
href = json.stringOf(L"notices[i].links[j].href");
v_type = json.stringOf(L"notices[i].links[j].type");
j = j + 1;
}
i = i + 1;
}
}