public function isBroken($url)
    {
        if (!$domain = parse_url($url, PHP_URL_HOST)) {
            return true;
        }

        if(in_array($domain, (array) apply_filters('brokenLinks/External/ExceptedDomains', array()))) {
            return false;
        }

        // Convert domain name to IDNA ASCII form
        if(count(explode('.', $domain)) == count(array_filter(explode('.', $domain),
            function($var) {
                if(strlen($var) < 1) {
                    return false; 
                }
                return true; 
            })))  
        {
            try {
                $punycode = new Punycode();
                $domainAscii = $punycode->encode($domain);
                $url = str_ireplace($domain, $domainAscii, $url);
            } catch (Exception $e) {
                return false;
            }
        }

        // Test if URL is internal and page exist
        if ($this->isInternal($url)) {
            return false;
        }

        // Validate domain name
        if (!$this->isValidDomainName(isset($domainAscii) ? $domainAscii : $domain)) {
            return true;
        }

        // Test if domain is available
        return !$this->isDomainAvailable($url);
    }
public function isBroken($url)
    {
        if (!$domain = parse_url($url, PHP_URL_HOST)) {
            return true;
        }

        if(in_array($domain, (array) apply_filters('brokenLinks/External/ExceptedDomains', array()))) {
            return false;
        }

        // Convert domain name to IDNA ASCII form
        if(count(explode('.', $domain)) == count(array_filter(explode('.', $domain),
            function($var) {
                if(strlen($var) < 1) {
                    return false; 
                }
                return true; 
            })))  
        {
            try {
                $punycode = new Punycode();
                $domainAscii = $punycode->encode($domain);
                $url = str_ireplace($domain, $domainAscii, $url);
            } catch (Exception $e) {
                return false;
            }
        }

        // Test if URL is internal and page exist
        if ($this->isInternal($url)) {
            return false;
        }

        // Validate domain name
        if (!$this->isValidDomainName(isset($domainAscii) ? $domainAscii : $domain)) {
            return true;
        }

        // Test if domain is available
        return !$this->isDomainAvailable($url);
    }
public function isBroken ( $ url ) { if ( ! $ domain = parse_url ( $ url , PHP_URL_HOST ) ) { return true ; } if ( in_array ( $ domain , ( array ) apply_filters ( 'brokenLinks/External/ExceptedDomains' , array ( ) ) ) ) { return false ; } // Convert domain name to IDNA ASCII form if ( count ( explode ( '.' , $ domain ) ) == count ( array_filter ( explode ( '.' , $ domain ) , function ( $ var ) { if ( strlen ( $ var ) < 1 ) { return false ; } return true ; } ) ) ) { try { $ punycode = new Punycode ( ) ; $ domainAscii = $ punycode -> encode ( $ domain ) ; $ url = str_ireplace ( $ domain , $ domainAscii , $ url ) ; } catch ( Exception $ e ) { return false ; } } // Test if URL is internal and page exist if ( $ this -> isInternal ( $ url ) ) { return false ; } // Validate domain name if ( ! $ this -> isValidDomainName ( isset ( $ domainAscii ) ? $ domainAscii : $ domain ) ) { return true ; } // Test if domain is available return ! $ this -> isDomainAvailable ( $ url ) ; }
Test if domain is valid with different methods
@param  string $url Url to check
@return boolean
Test if domain is valid with different methods