![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Delphi DLL) RDAP Domain Lookup using rdap.orgDemonstrates doing an RDAP domain lookup using the rdap.org public RDAP server. Note: This example requires Chilkat v11.0.0 or greater.
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Http, StringBuilder, JsonObject; ... procedure TForm1.Button1Click(Sender: TObject); var success: Boolean; http: HCkHttp; sbResponse: HCkStringBuilder; statusCode: Integer; json: HCkJsonObject; value: PWideChar; rel: PWideChar; href: PWideChar; v_type: PWideChar; strVal: PWideChar; j: Integer; count_j: Integer; identifier: PWideChar; k: Integer; count_k: Integer; json1: HCkJsonObject; i1: Integer; count_i1: Integer; j1: Integer; count_j1: Integer; eventAction: PWideChar; eventDate: PWideChar; title: PWideChar; objectClassName: PWideChar; handle: PWideChar; ldhName: PWideChar; DelegationSigned: Boolean; i: Integer; count_i: Integer; begin success := False; // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http := CkHttp_Create(); // 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" sbResponse := CkStringBuilder_Create(); success := CkHttp_QuickGetSb(http,'https://rdap.org/domain/oracle.com',sbResponse); if (success = False) then begin Memo1.Lines.Add(CkHttp__lastErrorText(http)); Exit; end; statusCode := CkHttp_getLastStatus(http); if (statusCode <> 200) then begin Memo1.Lines.Add('Error response:'); Memo1.Lines.Add(CkStringBuilder__getAsString(sbResponse)); Memo1.Lines.Add('status code: ' + IntToStr(statusCode)); Exit; end; // Load the JSON response and examine.. // Use this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON json := CkJsonObject_Create(); CkJsonObject_LoadSb(json,sbResponse); CkJsonObject_putEmitCompact(json,False); Memo1.Lines.Add(CkJsonObject__emit(json)); // 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" // } // ] // } // ] // } json1 := CkJsonObject_Create(); objectClassName := CkJsonObject__stringOf(json,'objectClassName'); handle := CkJsonObject__stringOf(json,'handle'); ldhName := CkJsonObject__stringOf(json,'ldhName'); DelegationSigned := CkJsonObject_BoolOf(json,'secureDNS.delegationSigned'); i := 0; count_i := CkJsonObject_SizeOfArray(json,'links'); while i < count_i do begin CkJsonObject_putI(json,i); value := CkJsonObject__stringOf(json,'links[i].value'); rel := CkJsonObject__stringOf(json,'links[i].rel'); href := CkJsonObject__stringOf(json,'links[i].href'); v_type := CkJsonObject__stringOf(json,'links[i].type'); i := i + 1; end; i := 0; count_i := CkJsonObject_SizeOfArray(json,'status'); while i < count_i do begin CkJsonObject_putI(json,i); strVal := CkJsonObject__stringOf(json,'status[i]'); i := i + 1; end; i := 0; count_i := CkJsonObject_SizeOfArray(json,'entities'); while i < count_i do begin CkJsonObject_putI(json,i); objectClassName := CkJsonObject__stringOf(json,'entities[i].objectClassName'); handle := CkJsonObject__stringOf(json,'entities[i].handle'); j := 0; count_j := CkJsonObject_SizeOfArray(json,'entities[i].roles'); while j < count_j do begin CkJsonObject_putJ(json,j); strVal := CkJsonObject__stringOf(json,'entities[i].roles[j]'); j := j + 1; end; j := 0; count_j := CkJsonObject_SizeOfArray(json,'entities[i].publicIds'); while j < count_j do begin CkJsonObject_putJ(json,j); v_type := CkJsonObject__stringOf(json,'entities[i].publicIds[j].type'); identifier := CkJsonObject__stringOf(json,'entities[i].publicIds[j].identifier'); j := j + 1; end; j := 0; count_j := CkJsonObject_SizeOfArray(json,'entities[i].vcardArray'); while j < count_j do begin CkJsonObject_putJ(json,j); strVal := CkJsonObject__stringOf(json,'entities[i].vcardArray[j]'); k := 0; count_k := CkJsonObject_SizeOfArray(json,'entities[i].vcardArray[j]'); while k < count_k do begin CkJsonObject_putK(json,k); CkJsonObject_ObjectOf2(json,'entities[i].vcardArray[j][k]',json1); i1 := 0; count_i1 := CkJsonObject_SizeOfArray(json1,''); while i1 < count_i1 do begin CkJsonObject_putI(json1,i1); strVal := CkJsonObject__stringOf(json1,'[i]'); i1 := i1 + 1; end; k := k + 1; end; j := j + 1; end; j := 0; count_j := CkJsonObject_SizeOfArray(json,'entities[i].entities'); while j < count_j do begin CkJsonObject_putJ(json,j); objectClassName := CkJsonObject__stringOf(json,'entities[i].entities[j].objectClassName'); k := 0; count_k := CkJsonObject_SizeOfArray(json,'entities[i].entities[j].roles'); while k < count_k do begin CkJsonObject_putK(json,k); strVal := CkJsonObject__stringOf(json,'entities[i].entities[j].roles[k]'); k := k + 1; end; k := 0; count_k := CkJsonObject_SizeOfArray(json,'entities[i].entities[j].vcardArray'); while k < count_k do begin CkJsonObject_putK(json,k); strVal := CkJsonObject__stringOf(json,'entities[i].entities[j].vcardArray[k]'); CkJsonObject_ObjectOf2(json,'entities[i].entities[j].vcardArray[k]',json1); i1 := 0; count_i1 := CkJsonObject_SizeOfArray(json1,''); while i1 < count_i1 do begin CkJsonObject_putI(json1,i1); j1 := 0; count_j1 := CkJsonObject_SizeOfArray(json1,'[i]'); while j1 < count_j1 do begin CkJsonObject_putJ(json1,j1); strVal := CkJsonObject__stringOf(json1,'[i][j]'); j1 := j1 + 1; end; i1 := i1 + 1; end; k := k + 1; end; j := j + 1; end; i := i + 1; end; i := 0; count_i := CkJsonObject_SizeOfArray(json,'events'); while i < count_i do begin CkJsonObject_putI(json,i); eventAction := CkJsonObject__stringOf(json,'events[i].eventAction'); eventDate := CkJsonObject__stringOf(json,'events[i].eventDate'); i := i + 1; end; i := 0; count_i := CkJsonObject_SizeOfArray(json,'nameservers'); while i < count_i do begin CkJsonObject_putI(json,i); objectClassName := CkJsonObject__stringOf(json,'nameservers[i].objectClassName'); ldhName := CkJsonObject__stringOf(json,'nameservers[i].ldhName'); i := i + 1; end; i := 0; count_i := CkJsonObject_SizeOfArray(json,'rdapConformance'); while i < count_i do begin CkJsonObject_putI(json,i); strVal := CkJsonObject__stringOf(json,'rdapConformance[i]'); i := i + 1; end; i := 0; count_i := CkJsonObject_SizeOfArray(json,'notices'); while i < count_i do begin CkJsonObject_putI(json,i); title := CkJsonObject__stringOf(json,'notices[i].title'); j := 0; count_j := CkJsonObject_SizeOfArray(json,'notices[i].description'); while j < count_j do begin CkJsonObject_putJ(json,j); strVal := CkJsonObject__stringOf(json,'notices[i].description[j]'); j := j + 1; end; j := 0; count_j := CkJsonObject_SizeOfArray(json,'notices[i].links'); while j < count_j do begin CkJsonObject_putJ(json,j); href := CkJsonObject__stringOf(json,'notices[i].links[j].href'); v_type := CkJsonObject__stringOf(json,'notices[i].links[j].type'); j := j + 1; end; i := i + 1; end; CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponse); CkJsonObject_Dispose(json); CkJsonObject_Dispose(json1); end; |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.