I own a website which allows users to download Youtube videos. I need php scripts which detects if a youtube url is present, like:
givemeyoutube.com takes users to my normal website but if they type,
http://www.givemeyoutube.com/watch?v=OZLUa8JUR18
how do I take them to the index of my website and strip out the “watch?v=OZLUa8JUR18” and store it as a variable?
UPDATE: How can I do it so that it checks URL and if it contains “watch?v=” then redirect to another page?
Use preg_match with the following regular expression
/(\/watch\?v=)([a-zA-Z0-9_-]+)/