Validate URL Script

Validate URL Script is use to validate a url through regular expression.

Demo :

Email :    

Example :

Just type a proper url like this and click check button URL Is valid message will display otherwise type a inproper url like this http://sometime at textbox and click check button URL Is Invalid message will display here.

Code :

Following code is use to Validate URL Address Script if you need to copy and use to your website.

  function validateUrl($str)
    return preg_match("/^(http|https|ftp):\/\/([a-z0-9]([a-z0-9_-]*[a-z0-9])?\.)+[a-z]{2,6}\/?([a-z0-9\?\._-~&#=+%]*)?/", $str);
  $url = "";
  echo validateUrl($url) ? "Url Is valid" : "Url Is invalid";

In the above $url variable is use to assign the url. In the validateUrl() function is use to check the validate url through regular expression.Here in the regular expression used to restricts the protocols which is HTTP, HTTPS, or FTP to requires the top-level domain to be between two and six characters long, and supports trailing path/file names or anchors.

Free Download Script :

If you need to Validate Url Script click and download from following link.