Hi All!
I have some troubles with dynamically displaying/embedding YouTube videos on my site. Namely, I have the YouTube URL in a mysql table, something like
http://www.youtube.com/watch?v=NZ1lrK72ldE&feature=popular
BUT : the video is not displaying at my site until I change the URL at the mysql table to :
http://www.youtube.com/v/NZ1lrK72ldE&feature=popular
like it would be if you want to EMBED it.
I tried to change the URL with :
$patterns = array();
$replacements = array();
$patterns[0] = '/watch?v=/';
$replacements[0] = 'v/';
$video_url = preg_replace($patterns, $replacements, $video_url);
but it haven’t changed the url. Can someone give a tip how should I solve this?
Thnx in advance!