How does the response from whois.nic.de affect the functionality of the domain check script?

The response from whois.nic.de may affect the functionality of the domain check script if it does not return the expected data format. To solve this, we can parse the response to extract the necessary information, such as the domain status or expiration date.

<?php
// Function to check domain availability
function checkDomainAvailability($domain) {
    $whois_response = file_get_contents('https://www.whois.nic.de/rest/whois?q=' . $domain);
    
    // Parse the response to extract the domain status
    if (strpos($whois_response, 'Status: free') !== false) {
        return "Domain $domain is available";
    } else {
        return "Domain $domain is not available";
    }
}

// Usage example
$domain = "example.com";
echo checkDomainAvailability($domain);
?>