tags:

views:

41

answers:

1

Hi,

I Want a php code to turn a youtube/dailymotion/vimeo/metacafe... URL into an EMBEDABLE code so i can show it using echo , it is really hard to read the API of every website, so i'm wondering if there is a class or code to do this.

Note: if there isn't anyone, then maybe a jQuery facebox alternative who supports more than youtube.

Thanks

+1  A: 

it's not so difficult.

youtube link is like this http://www.youtube.com/watch?v=XXXX where XXXX is the video ID.

and this is the code for embedding the video

<object width="480" height="385">
<param name="movie" value="http://www.youtube.com/v/XXXX&amp;hl=en_US&amp;fs=1&amp;"&gt;
</param>
<param name="allowFullScreen" value="true">
</param>
<param name="allowscriptaccess" value="always">
</param>
<embed src="http://www.youtube.com/v/XXXX&amp;hl=en_US&amp;fs=1&amp;" 
type="application/x-shockwave-flash" allowscriptaccess="always" 
allowfullscreen="true" width="480" height="385"></embed>
</object>

you only need to parse (ie. using php) the youtube links and then insert the found id insted of XXXX

Marcx