Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Wyciąganie ID z linka youtube, Wyciąganie ID z linka youtube na preg_replace
slawiz
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 27.06.2012

Ostrzeżenie: (0%)
-----


Witam potrzebuje pomocy otóż chce napisać skrypt który będzie wyciągał ID youtube z filmiku.

Na razie wymyśliłem coś takiego:

  1. $text2 = 'http://www.youtube.com/watch?v=EztDIotz7Nc&feature=related';
  2.  
  3.  
  4. $stalal = preg_replace("#\http://(?:www\.)?youtube.com/watch\?v=#",'',$text2);
  5.  
  6.  
  7. echo '<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/' .$stalal. '" frameborder="0" allowfullscreen></iframe> ';



ale musze jeszcze usunąć "feature=related" z "$stalal" poniewarz zostaje "EztDIotz7Nc&feature=related"

Proszę o pomoc, z góry dziękuje (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 18.09.2025 - 04:54