Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(SQL Server) RDAP Domain Lookup using rdap.orgDemonstrates doing an RDAP domain lookup using the rdap.org public RDAP server.
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) -- This example requires the Chilkat API to have been previously unlocked. -- See Global Unlock Sample for sample code. DECLARE @http int -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- 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" DECLARE @sbResponse int -- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponse OUT DECLARE @success int EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://rdap.org/domain/oracle.com', @sbResponse IF @success = 0 BEGIN EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @sbResponse RETURN END DECLARE @statusCode int EXEC sp_OAGetProperty @http, 'LastStatus', @statusCode OUT IF @statusCode <> 200 BEGIN PRINT 'Error response:' EXEC sp_OAMethod @sbResponse, 'GetAsString', @sTmp0 OUT PRINT @sTmp0 PRINT 'status code: ' + @statusCode EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @sbResponse RETURN END -- Load the JSON response and examine.. -- Use this online tool to generate parsing code from sample JSON: -- Generate Parsing Code from JSON DECLARE @json int -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT EXEC sp_OAMethod @json, 'LoadSb', @success OUT, @sbResponse EXEC sp_OASetProperty @json, 'EmitCompact', 0 EXEC sp_OAMethod @json, 'Emit', @sTmp0 OUT PRINT @sTmp0 -- 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" -- } -- ] -- } -- ] -- } DECLARE @value nvarchar(4000) DECLARE @rel nvarchar(4000) DECLARE @href nvarchar(4000) DECLARE @v_type nvarchar(4000) DECLARE @strVal nvarchar(4000) DECLARE @j int DECLARE @count_j int DECLARE @identifier nvarchar(4000) DECLARE @k int DECLARE @count_k int DECLARE @json1 int DECLARE @i1 int DECLARE @count_i1 int DECLARE @j1 int DECLARE @count_j1 int DECLARE @eventAction nvarchar(4000) DECLARE @eventDate nvarchar(4000) DECLARE @title nvarchar(4000) DECLARE @objectClassName nvarchar(4000) EXEC sp_OAMethod @json, 'StringOf', @objectClassName OUT, 'objectClassName' DECLARE @handle nvarchar(4000) EXEC sp_OAMethod @json, 'StringOf', @handle OUT, 'handle' DECLARE @ldhName nvarchar(4000) EXEC sp_OAMethod @json, 'StringOf', @ldhName OUT, 'ldhName' DECLARE @DelegationSigned int EXEC sp_OAMethod @json, 'BoolOf', @DelegationSigned OUT, 'secureDNS.delegationSigned' DECLARE @i int SELECT @i = 0 DECLARE @count_i int EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'links' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @json, 'I', @i EXEC sp_OAMethod @json, 'StringOf', @value OUT, 'links[i].value' EXEC sp_OAMethod @json, 'StringOf', @rel OUT, 'links[i].rel' EXEC sp_OAMethod @json, 'StringOf', @href OUT, 'links[i].href' EXEC sp_OAMethod @json, 'StringOf', @v_type OUT, 'links[i].type' SELECT @i = @i + 1 END SELECT @i = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'status' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @json, 'I', @i EXEC sp_OAMethod @json, 'StringOf', @strVal OUT, 'status[i]' SELECT @i = @i + 1 END SELECT @i = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'entities' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @json, 'I', @i EXEC sp_OAMethod @json, 'StringOf', @objectClassName OUT, 'entities[i].objectClassName' EXEC sp_OAMethod @json, 'StringOf', @handle OUT, 'entities[i].handle' SELECT @j = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'entities[i].roles' WHILE @j < @count_j BEGIN EXEC sp_OASetProperty @json, 'J', @j EXEC sp_OAMethod @json, 'StringOf', @strVal OUT, 'entities[i].roles[j]' SELECT @j = @j + 1 END SELECT @j = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'entities[i].publicIds' WHILE @j < @count_j BEGIN EXEC sp_OASetProperty @json, 'J', @j EXEC sp_OAMethod @json, 'StringOf', @v_type OUT, 'entities[i].publicIds[j].type' EXEC sp_OAMethod @json, 'StringOf', @identifier OUT, 'entities[i].publicIds[j].identifier' SELECT @j = @j + 1 END SELECT @j = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'entities[i].vcardArray' WHILE @j < @count_j BEGIN EXEC sp_OASetProperty @json, 'J', @j EXEC sp_OAMethod @json, 'StringOf', @strVal OUT, 'entities[i].vcardArray[j]' SELECT @k = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_k OUT, 'entities[i].vcardArray[j]' WHILE @k < @count_k BEGIN EXEC sp_OASetProperty @json, 'K', @k EXEC sp_OAMethod @json, 'ObjectOf', @json1 OUT, 'entities[i].vcardArray[j][k]' SELECT @i1 = 0 EXEC sp_OAMethod @json1, 'SizeOfArray', @count_i1 OUT, '' WHILE @i1 < @count_i1 BEGIN EXEC sp_OASetProperty @json1, 'I', @i1 EXEC sp_OAMethod @json1, 'StringOf', @strVal OUT, '[i]' SELECT @i1 = @i1 + 1 END EXEC @hr = sp_OADestroy @json1 SELECT @k = @k + 1 END SELECT @j = @j + 1 END SELECT @j = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'entities[i].entities' WHILE @j < @count_j BEGIN EXEC sp_OASetProperty @json, 'J', @j EXEC sp_OAMethod @json, 'StringOf', @objectClassName OUT, 'entities[i].entities[j].objectClassName' SELECT @k = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_k OUT, 'entities[i].entities[j].roles' WHILE @k < @count_k BEGIN EXEC sp_OASetProperty @json, 'K', @k EXEC sp_OAMethod @json, 'StringOf', @strVal OUT, 'entities[i].entities[j].roles[k]' SELECT @k = @k + 1 END SELECT @k = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_k OUT, 'entities[i].entities[j].vcardArray' WHILE @k < @count_k BEGIN EXEC sp_OASetProperty @json, 'K', @k EXEC sp_OAMethod @json, 'StringOf', @strVal OUT, 'entities[i].entities[j].vcardArray[k]' EXEC sp_OAMethod @json, 'ObjectOf', @json1 OUT, 'entities[i].entities[j].vcardArray[k]' SELECT @i1 = 0 EXEC sp_OAMethod @json1, 'SizeOfArray', @count_i1 OUT, '' WHILE @i1 < @count_i1 BEGIN EXEC sp_OASetProperty @json1, 'I', @i1 SELECT @j1 = 0 EXEC sp_OAMethod @json1, 'SizeOfArray', @count_j1 OUT, '[i]' WHILE @j1 < @count_j1 BEGIN EXEC sp_OASetProperty @json1, 'J', @j1 EXEC sp_OAMethod @json1, 'StringOf', @strVal OUT, '[i][j]' SELECT @j1 = @j1 + 1 END SELECT @i1 = @i1 + 1 END EXEC @hr = sp_OADestroy @json1 SELECT @k = @k + 1 END SELECT @j = @j + 1 END SELECT @i = @i + 1 END SELECT @i = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'events' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @json, 'I', @i EXEC sp_OAMethod @json, 'StringOf', @eventAction OUT, 'events[i].eventAction' EXEC sp_OAMethod @json, 'StringOf', @eventDate OUT, 'events[i].eventDate' SELECT @i = @i + 1 END SELECT @i = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'nameservers' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @json, 'I', @i EXEC sp_OAMethod @json, 'StringOf', @objectClassName OUT, 'nameservers[i].objectClassName' EXEC sp_OAMethod @json, 'StringOf', @ldhName OUT, 'nameservers[i].ldhName' SELECT @i = @i + 1 END SELECT @i = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'rdapConformance' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @json, 'I', @i EXEC sp_OAMethod @json, 'StringOf', @strVal OUT, 'rdapConformance[i]' SELECT @i = @i + 1 END SELECT @i = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'notices' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @json, 'I', @i EXEC sp_OAMethod @json, 'StringOf', @title OUT, 'notices[i].title' SELECT @j = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'notices[i].description' WHILE @j < @count_j BEGIN EXEC sp_OASetProperty @json, 'J', @j EXEC sp_OAMethod @json, 'StringOf', @strVal OUT, 'notices[i].description[j]' SELECT @j = @j + 1 END SELECT @j = 0 EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'notices[i].links' WHILE @j < @count_j BEGIN EXEC sp_OASetProperty @json, 'J', @j EXEC sp_OAMethod @json, 'StringOf', @href OUT, 'notices[i].links[j].href' EXEC sp_OAMethod @json, 'StringOf', @v_type OUT, 'notices[i].links[j].type' SELECT @j = @j + 1 END SELECT @i = @i + 1 END EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @sbResponse EXEC @hr = sp_OADestroy @json END GO |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.