PHP code example of monovm / whois-php

1. Go to this page and download the library: Download monovm/whois-php 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/ */

    

monovm / whois-php example snippets


use MonoVM\WhoisPhp\Checker;

// Single Domain whois
$result1 = Checker::whois('monovm.com');

// Single Domain whois without specifying TLD
$result2 = Checker::whois('monovm');

// Multiple domains whois
$result3 = Checker::whois(['monovm','google.com','bing']);

use MonoVM\WhoisPhp\Checker;

$result = Checker::whois('monovm', ['popularTLDs' => ['.com', '.net', '.org', '.info']]);

use MonoVM\WhoisPhp\WhoisHandler;

$whoisHandler = WhoisHandler::whois('monovm.com');

$available = $whoisHandler->isAvailable();

$valid = $whoisHandler->isValid();

$message = $whoisHandler->getWhoisMessage();

$tld = $whoisHandler->getTld();

$sld = $whoisHandler->getSld();

$details = $whoisHandler->getAvailabilityDetails();

// Example output:
// Array
// (
//     [original_library_result] => false
//     [contains_availability_keywords] => true
//     [is_response_too_short] => false
//     [contains_no_match_patterns] => true
//     [tld_specific_patterns] => false
//     [domain_status_indicators] => false
//     [final_availability] => true
//     [whois_message_length] => 1234
//     [whois_message_preview] => "No match for domain example123.com..."
// )
bash
composer