Visual FoxPro
Visual FoxPro
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 Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loHttp
LOCAL loSbResponse
LOCAL lnStatusCode
LOCAL loJson
LOCAL lcValue
LOCAL lcRel
LOCAL lcHref
LOCAL lcV_type
LOCAL lcStrVal
LOCAL j
LOCAL lnCount_j
LOCAL lcIdentifier
LOCAL k
LOCAL lnCount_k
LOCAL loJson1
LOCAL lnI1
LOCAL lnCount_i1
LOCAL lnJ1
LOCAL lnCount_j1
LOCAL lcEventAction
LOCAL lcEventDate
LOCAL lcTitle
LOCAL lcObjectClassName
LOCAL lcHandle
LOCAL lcLdhName
LOCAL lnDelegationSigned
LOCAL i
LOCAL lnCount_i
lnSuccess = 0
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loHttp = CreateObject('Chilkat.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"
loSbResponse = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://rdap.org/domain/oracle.com",loSbResponse)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loSbResponse
CANCEL
ENDIF
lnStatusCode = loHttp.LastStatus
IF (lnStatusCode <> 200) THEN
? "Error response:"
? loSbResponse.GetAsString()
? "status code: " + STR(lnStatusCode)
RELEASE loHttp
RELEASE loSbResponse
CANCEL
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('Chilkat.JsonObject')
loJson.LoadSb(loSbResponse)
loJson.EmitCompact = 0
? 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('Chilkat.JsonObject')
lcObjectClassName = loJson.StringOf("objectClassName")
lcHandle = loJson.StringOf("handle")
lcLdhName = loJson.StringOf("ldhName")
lnDelegationSigned = 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