Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2015
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. public function convertyoutube($link) {
  2.            
  3.             if (strpos($link, 'youtube.com/watch?v=') == true) {
  4.                
  5.                 $url = $link;
  6.                 parse_str(parse_url($url, PHP_URL_QUERY), $youtube_array);
  7.                 preg_match("/[^\s]*/", $youtube_array['v'], $matches);
  8.                 $videoid = $matches[0];
  9.  
  10.                 $embed = "<iframe width='420' height='315' src='https://www.youtube.com/embed/".$videoid."'></iframe>"; // what it should create with the extracted code
  11.  
  12.                 return $embed;
  13.            
  14.             }
  15.            
  16.            
  17.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement