PHP code example of xandco / whoisparser

1. Go to this page and download the library: Download xandco/whoisparser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xandco / whoisparser example snippets

 php
// config/app.php

'providers' => [
    WhoisParser\WhoisParserServiceProvider::class,
];
 bash
$ php artisan vendor:publish --provider="WhoisParser\WhoisParserServiceProvider"
 php
use WhoisParser\WhoisParser;
...
$whoisParser = new WhoisParser( $options = [] );
 php
$whoisParser->parse( '% IANA WHOIS server\n...' ); // root data
$whoisParser->parse( 'Domain Name: EXAMPLE.COM\n...' ); // whois data
 php
/*
 * Example of the `root` type output
 */
[
    'domain' => 'com',
    'is_valid' => true,
    'type' => 'root',
    'data' => [
        'status' => 'active',
        'whois' => 'whois.example.com',
        'contacts' => [
            'sponsor' => [
                'organisation' => 'Example Global Registry Services',
                'address' => [
                    '12345 Example Way',
                    'San Francisco California 94112',
                    'United States'
                ]
            ],
            'administrative' => [...],
            'technical' => [...],
        ],
        'nameservers' => [
            [
                'host' => 'ns.example.com',
                'ipv4' => '127.0.0.0',
                'ipv6' => '::1'
            ],
            ...
        ],
        'dates' => [
            'created' => '1985-01-01 00:00:00',
            'updated' => '2017-10-05 00:00:00',
        ]
    ],
    'raw' => '% IANA WHOIS server\n...' // depending on options
]

/*
 * Example of the `whois` type output
 */
[
    'domain' => 'example.com',
    'is_valid' => true,
    'is_reserved' => false,
    'is_available' => false,
    'type' => 'whois',
    'data' => [
        '_id' => '0897654321_DOMAIN_COM-EXPL',
        'status' => [
            [
                'code' => 'clientUpdateProhibited',
                'url' => 'https:\/\/www.icann.org\/epp#clientUpdateProhibited'
            ],
            ...
        ],
        'whois' => 'whois.example.com',
        'registrar' => [
            '_id' => '123',
            'name' => 'Example, Inc.',
            'whois' => 'whois.example.com',
            'abuse_contact' => [
                'email' => '[email protected]',
                'phone' => '+1.4003219876',
            ],
        ],
        'contacts' => [
            'registrant' => [
                'name' => 'Domain Administrator',
                'organization' => 'Example Corporation',
                'address' => {
                   'street' => '12345 Example Way',
                   'city' => 'San Francisco',
                   'state_province' => 'CA',
                   'postal_code' => '94112',
                   'country' => 'US'
                 },
                'phone' => '+1.0981237645',
                'phone_ext' => null,
                'fax' => '+1.1230984567',
                'fax_ext' => null,
                'email' => '[email protected]',
            ],
            'administrative' => [...],
            'technical' => [...],
            'billing' => [...], // depending on options
        ],
        'nameservers' => [
            [
                'host' => 'ns.example.com',
                'ipv4' => null, // depending on options
                'ipv6' => null // depending on options
            ],
            ...
        ],
        'dnssec' => 'unsigned',
        'dates' => [
            'created' => '1991-05-01 21:00:00',
            'updated' => '2020-06-03 13:24:15',
            'expiration' => '2021-05-02 21:00:00',
        ]
    ],
    'raw' => 'Domain Name: EXAMPLE.COM\n...' // depending on options
]