How can this be changed to allow either HTTP or HTTPS for a Vine URL?
$vineURL = 'https://vine.co/v/';
$pos = stripos($url_input_value, $vineURL);
if ($pos === 0) {
echo "The url '$url' is a vine URL";
}
else {
echo "The url '$url' is not a vine URL";
}
You can use the
parse_url
function, it breaks the URL into its components making it easier to match each component individually:You can then just check if
scheme
,host
andpath
match: