I’m writing a program to embed youtube videos. The user will submit the URL (http://www.youtube.com/watch?v=IoBP24I2lwA) and i need to separate the “IoBP24I2lwA”. The problem is, not all youtube videos end with the “v” variable so i cant just do a substring until it gets to the “=” sign. Some urls look like this: “http://www.youtube.com/watch?v=IoBP24I2lwA&feature=branded”.
Is there a way to get just the “v” variable, like using $_GET[‘v’]…just for a string instead?
Thanks,
Ian
You can do this with
parse_url()andparse_str():