Validate Domain Name


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $url = "http://komunitasweb.com/";
  2. if (preg_match('/^(http|https|ftp)://([A-Z0-9][A-Z0-9_-]*(?:.[A-Z0-9][A-Z0-9_-]*)+):?(d+)?/?/i', $url)) {
  3. echo "Your url is ok.";
  4. } else {
  5. echo "Wrong url.";
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.