URL Validation Class In PHP
A couple days ago i’ve been struggling with URL validation in PHP. And i found a URL validation class from phpclasses.org which i think is great and do what i need. And to use it, is really simple. Beside validate url, this class also can parse the url, so you can get all the url details.
This url validation class is develop by Kaloyan Kirilov Tzvetkov, all credits is goes to him.
Here is the example to use it:
require("url-validation.class.php"); $URL = new mrsnk_URL_validation( $url, MRSNK_URL_DO_NOT_PRINT_ERRORS, MRSNK_URL_DO_NOT_CONNECT_2_URL); $valid = $URL->isValid(); // Boolean method, that checks // whether provided URL is valid // or not. echo ($valid)?"URL is valid":"URL's not valid";
It’s pretty handy and safe your headache, isn’t it?
Download url validation class for PHP.