How to code this in php?

cyrus_xi

New member
I need to use php to scan through a YouTube embed code for the video ID and place it into an image URL and return the URL as a string to be posted simply as an HTML tag.*

So I need to take this(I had to add some spaces to the urls so they remained intact):

<object width="560" height="340"><param name="movie" value="ht tp://www.youtube.co m/v/NU4sKpIv7pI?fs=1&hl=en_US&rel=0&color1=0x3a3a3a&color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="ht tp://www.youtube.co m/v/NU4sKpIv7pI?fs=1&hl=en_US&rel=0&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>

And get this:

NU4sKpIv7pI



And turn it into this:

<img src="ht tp://img.youtube.co m/vi/NU4sKpIv7pI/0. jpg">


The embed code might have other stuff with it, but nothing else looking like a YouTube embed code. I need to be able to do this with Php because of the way the site I'm using it on is coded. It's not friendly with JavaScript.*

Thanks.*
 
Back
Top