Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2015
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 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('/[?&]v=(.+?)(?:&|\s|$)/', $link, $videoid);
  8.                
  9.  
  10.                 $embed = "<iframe width='420' height='315' src='https://www.youtube.com/embed/".$videoid[1]."'></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