I have a big doubt about how I can validate a URL from PHP but that, in addition, it has https protocol or it is incorrect.
Based on this I could say if a URL is valid:
Code:
<?php
// Variable to check
$url = "http://www.w3schools.com/";
// Remover los caracteres ilegales de la url
$url = filter_var($url, FILTER_SANITIZE_URL);
echo $url;
// Validar url
if (!filter_var($url, FILTER_VALIDATE_URL) === false) {
echo("$url es una URL valida");
} else {
echo("$url no es una URL valida");
}
?>
Now I just need to know if you have the https protocol.