Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to check validate url in php ?
If want to check validate url in php then you can use FILTER_VALIDATE_URL.This is filter validates a URL.
you can see below example
<?php
// Variable to check
$url = "http://www.example.com";
// Validate url
if (!filter_var($url, FILTER_VALIDATE_URL) === false) {
echo("$url is a valid URL");
} else {
echo("$url is not a valid URL");
}
?>
The output of the code above will be:
Success ! Url is a valid URL
0 Comment(s)