I'm trying to parse youtube link to the video, to insert it into the site.
The code is as follows:
$url = 'http://www.youtube.com/watch?v=jNQXAC9IVRw'; $parsed_url = parse_url($url); parse_str($parsed_url['query'], $parsed_query); echo '<iframe src="http://www.youtube.com/embed/' . $parsed_query['v'] . '" type="text/html" width="400" height="300" frameborder="0"></iframe>'; I use it on WordPress. The problem turned out to be that if a link is crammed into $ url, then everything is beautiful. But if I assign the value $ url dynamically from the admin panel, then I get the output of http://www.youtube.com/embed/ without the numerical code of the video.
jNQXAC9IVRw? Maybe he will be smart and add it to the embed? - cyadvert