I want to check if entered URL exist on YouTube or not before saving that URL in my database
I am using this code
$url = 'https://www.youtube.com/watch?v=KeaoSIKaxeg';
if(preg_match('/http:\/\/www\.youtube\.com\/watch\?v=[^&]+/', $url))
{
dd('match');
}
else
{
dd('not match');
}
I have tried everything but nothing works. It always returns 'not match' even if the URL is valid.