GUMP::validate_url_exists PHP Méthode

validate_url_exists() protected méthode

Usage: '' => 'url_exists'
protected validate_url_exists ( string $field, array $input, null $param = null ) : mixed
$field string
$input array
$param null
Résultat mixed
    protected function validate_url_exists($field, $input, $param = null)
    {
        if (!isset($input[$field]) || empty($input[$field])) {
            return;
        }
        $url = parse_url(strtolower($input[$field]));
        if (isset($url['host'])) {
            $url = $url['host'];
        }
        if (function_exists('checkdnsrr')) {
            if (checkdnsrr($url) === false) {
                return array('field' => $field, 'value' => $input[$field], 'rule' => __FUNCTION__, 'param' => $param);
            }
        } else {
            if (gethostbyname($url) == $url) {
                return array('field' => $field, 'value' => $input[$field], 'rule' => __FUNCTION__, 'param' => $param);
            }
        }
    }