Giter VIP home page Giter VIP logo

rdap-client's Introduction

RDAP CLIENT

RDAP Client For PHP (Formerly Whois via http protocol)

Requirements

  • php 8.1 or later
  • ext-json
  • ext-intl

IETF RDAP Reference

  • Registration Data Access Protocol (RDAP) Object Tagging #RFC8521
  • Security Services for the Registration Data Access Protocol (RDAP) #RFC7481
  • Registration Data Access Protocol (RDAP) Query Format #RFC9082
  • JSON Responses for the Registration Data Access Protocol (RDAP) #RFC9083
  • Finding the Authoritative Registration Data (RDAP) Service #RFC9224

Schema Inventory & Analysis of WHOIS object

  • Inventory and Analysis of WHOIS Registration Objects #RFC7485

IANA RDAP Data

Iana provide data about rdap

For list of predefined recovered IPv4 addresses: RecoveredIPv4.php

Example Usage

See Client.php for more methods

use ArrayAccess\RdapClient\Client;
use ArrayAccess\RdapClient\Interfaces\RdapRequestInterface;
use ArrayAccess\RdapClient\Protocols\AsnProtocol;
use ArrayAccess\RdapClient\Protocols\DomainProtocol;
use ArrayAccess\RdapClient\Protocols\IPv4Protocol;
use ArrayAccess\RdapClient\Protocols\IPv6Protocol;
use ArrayAccess\RdapClient\Protocols\NsProtocol;

$client = new Client();
/**
 * @var RdapRequestInterface<string, DomainProtocol> $request
 */
$domainName = 'example.com';
$request = $client->request($domainName);

/**
 * @var RdapRequestInterface<string, IPv4Protocol> $request
 */
$ipv4 = '192.0.47.59'; // iana.org ipv4
$request = $client->request($ipv4);

/**
 * @var RdapRequestInterface<string, IPv6Protocol> $request
 */
$ipv6 = '2404:6800:4003:c01::66'; // google.com
$request = $client->request($ipv6);

/**
 * @var RdapRequestInterface<string, NsProtocol> $request
 * Name server guessing by prefix (ns[0-9]*).domain-name.ext or [^\.]+.(ns[0-9]*.[^\.]+\.)(?:.+).domain-name.ext
 */
$nameserver = 'ns1.google.com'; // google name server
$request = $client->request($nameserver);

/**
 * @var RdapRequestInterface<string, AsnProtocol> $request
 * Autonomous System Number parsed by "^(?ASN?)?(?<as_number>[0-9]+)$"
 */
$asNumber = 'AS15169'; // Google LLC ASN
// or just put the numeric string / integer
$request = $client->request($asNumber);
// getting object response
$response = $request->getResponse();
// getting json data
$jsonResponse = $response->getResponseJson();
// getting definition object
$definition = $response->getDefinition();
// if domain > getting related / another whois server request if possible
$alternateRequest = $definition->getRelatedRequest();
// json serialize
$fallbackToJson = json_encode($definition, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
// direct call with custom request target
// makes sure the type of RDAP uri target is equal '/domain/GOOGLE.com' as domain-protocol
$newRequest = $request->withRdapSearchURL('https://rdap.markmonitor.com/rdap/domain/GOOGLE.COM');
$response = $newRequest->getResponse();

See Response/Definitions for more details about code

Note

The code of data definition contains strict types. Some of the invalid data will throw an error.

WHOIS Data Collection

Refer to: (gist) WHOIS List to get the list of whois servers / ip range / sTLD etc.

Caution! the gist contains huge data.

LICENSE

GPL-3.0-or-later

rdap-client's People

Stargazers

 avatar

Watchers

 avatar

Forkers

frdl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.