I am explaining you, How to check URL is valid or not in PHP.
I am going to explaining, how to check if a URL is valid in PHP using filter_var() function with FILTER_VALIDATE_URL filter. Use the following code to check if the URL is valid or not.
Example :
<?php
$urlcheck = "https://webdeveloperindia.in";
if (!filter_var($urlcheck, FILTER_VALIDATE_URL) === false) {
echo("this Url is valid");
} else {
echo("this Url is not valid");
}
?>
Result:
this Url is valid
Hello, Welcome to webdeveloperindia.in. I am a full-stack web developer. Email – [email protected] | Skype – azaruddin23. I have knowledge of PHP, Laravel, Magento 1/2, Codeigniter, WordPress, Joomla, Shopify, Git, Bitbuket, jQuery, Ajax, Javascript and ReactJS.