Varias soluciones que encontre buscando:
Código PHP:
Ver original<?
function youtubeUrlToHTML($url, $width = 425, $height = 344) {
$key = !empty( $v ) ?
$v : $url;
return '<object width="'.$width.'" height="'.$height.'"><param name="movie" value="http://www.youtube.com/v/'.$key.'&hl=es&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'.$key.'&hl=es&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="'.$width.'" height="'.$height.'"></embed></object>';
}
echo youtubeUrlToHTML($_POST['url']);
?>
Código PHP:
Ver originalfunction extraer_yt_id($url) {
print 'ID del video: '.$id;
} else {
print 'Enlace inválido';
}
}
Código PHP:
Ver original// EJEMPLO DE UNA URL
$url="http://www.youtube.com/watch?v=Aw-WHGNsTuQ&feature=related";
$exp="/v\/?=?([0-9A-Za-z-_]{11})/is";
$id = $matches[1][0];
echo (empty($id))?
"URL NO VALIDA" : $id;
Suerte, y antes de preguntar busca un poquito mas :P