Check whether url is valid with php

Use Filter Validator to validate url.

filter_var($url, FILTER_VALIDATE_URL);

Example using that,


if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
    die('Not a valid URL');
}

Comments

Popular posts from this blog

Fatal: LoadModule: error loading module 'mod_sql_mysql.c'

How to hide Android Soft Keyboard