Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function convertyoutube($link) {
- if (strpos($link, 'youtube.com/watch?v=') == true) {
- $url = $link;
- parse_str(parse_url($url, PHP_URL_QUERY), $youtube_array);
- preg_match('/[?&]v=(.+?)(?:&|\s|$)/', $link, $videoid);
- $embed = "<iframe width='420' height='315' src='https://www.youtube.com/embed/".$videoid[1]."'></iframe>"; // what it should create with the extracted code
- return $embed;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement