tyra Posted March 13, 2012 Share Posted March 13, 2012 Hi! $url = "http://www.youtube.com/watch?feature=player_embedded&v=IwPHy17Iu6E"; I have code if (preg_match("/http:\/\/www.youtube.com\/watch\?v=([0-9a-zA-Z-_]*)(.*)/i", $url, $matches)) { return '<object height="'.$embed_height.'" width="'.$embed_width.'">'. '<param name="movie" value="http://www.youtube.com/v/'.$matches[1].'" />'. '<param name="wmode" value="transparent" />'. '<embed src="http://www.youtube.com/v/'.$matches[1].'&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" height="'.$embed_height.'" width="'.$embed_width.'" />'. '</object>'; } How to remove feature=player_embedded& from $url ? Quote Link to comment https://forums.phpfreaks.com/topic/258795-get-parameter-from-url/ Share on other sites More sharing options...
scootstah Posted March 13, 2012 Share Posted March 13, 2012 Not sure it will work in all situations, but a simple str_replace should do the trick. $url = "http://www.youtube.com/watch?feature=player_embedded&v=IwPHy17Iu6E"; $url = str_replace('feature=player_embedded&', '', $url); Quote Link to comment https://forums.phpfreaks.com/topic/258795-get-parameter-from-url/#findComment-1326689 Share on other sites More sharing options...
QuickOldCar Posted March 13, 2012 Share Posted March 13, 2012 Take a look at this script I wrote to embed multiple youtube videos from within a bunch of text. It will handle the shortened youtube.be urls. I have it fetch the video data from youtube's api also. Fullscreen works. http://www.phpfreaks.com/forums/index.php?topic=342974.msg1619535#msg1619535 Quote Link to comment https://forums.phpfreaks.com/topic/258795-get-parameter-from-url/#findComment-1326735 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.