/ Published in: PHP
The following function validates and returns TRUE or FALSE if the supplied string could be a valid domain name format.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function validUrl($url) { if (preg_match('/^(http|https|ftp)://([A-Z0-9][A-Z0-9_-]*(?:.[A-Z0-9][A-Z0-9_-]*)+):?(d+)?/?/i', $url)) { return TRUE; else return FALSE; } } ?>