public static function isDnsError(string $domain): bool
    {
        if (\function_exists('checkdnsrr')) {
            /** @noinspection IfReturnReturnSimplificationInspection */
            $mxFound = \checkdnsrr($domain . '.', 'MX');
            if ($mxFound === true) {
                return false;
            }

            $aFound = \checkdnsrr($domain . '.', 'A');
            /** @noinspection IfReturnReturnSimplificationInspection */
            if ($aFound === true) {
                return false;
            }

            return true;
        }

        throw new \Exception(' Can\'t call checkdnsrr');
    }
public static function isDnsError(string $domain): bool
    {
        if (\function_exists('checkdnsrr')) {
            /** @noinspection IfReturnReturnSimplificationInspection */
            $mxFound = \checkdnsrr($domain . '.', 'MX');
            if ($mxFound === true) {
                return false;
            }

            $aFound = \checkdnsrr($domain . '.', 'A');
            /** @noinspection IfReturnReturnSimplificationInspection */
            if ($aFound === true) {
                return false;
            }

            return true;
        }

        throw new \Exception(' Can\'t call checkdnsrr');
    }
public static function isDnsError ( string $ domain ) : bool { if ( \ function_exists ( 'checkdnsrr' ) ) { /** @noinspection IfReturnReturnSimplificationInspection */ $ mxFound = \ checkdnsrr ( $ domain . '.' , 'MX' ) ; if ( $ mxFound === true ) { return false ; } $ aFound = \ checkdnsrr ( $ domain . '.' , 'A' ) ; /** @noinspection IfReturnReturnSimplificationInspection */ if ( $ aFound === true ) { return false ; } return true ; } throw new \ Exception ( ' Can\'t call checkdnsrr' ) ; }
Check if the domain has a MX- or A-record in the DNS.

@param string $domain

@throws \Exception

@return bool
Check if the domain has a MX - or A - record in the DNS .