Ver Mensaje Individual
  #4 (permalink)  
Antiguo 29/05/2010, 16:02
rpv
 
Fecha de Ingreso: febrero-2010
Mensajes: 275
Antigüedad: 14 años, 2 meses
Puntos: 10
Respuesta: videos youtube

Código PHP:
Ver original
  1. function YouID($i){
  2.     $r='';
  3.     $i=explode('?',$i);
  4.     if(count($i)>1){
  5.         $i=explode('&',$i[1]);
  6.         foreach($i As $v){if(substr($v,0,2)=='v='){$r=substr($v,2);break;}}
  7.     }
  8.     return $r;}
  9.  
  10. //uso:
  11. $str='http://www.youtube.com/watch?v=f9IvUS4ipZk';
  12. echo YouID($str);//regresa: f9IvUS4ipZk
  13.  
  14. echo YouID('http://www.youtube.com/watch?v=JwbVOcysUaQ&feature=player_embedded');//regresa: JwbVOcysUaQ