Jump to content

Please help with pre_match! Please


hawkeyes

Recommended Posts

Hello all;

 

I want to embedded videos from some website, so i made this code

 

if (preg_match("/http:\/\/youtube.com\/watch\?v=([0-9a-zA-Z-_-]*)(.*)/i", $url, $matches)) {
        return '<object width="425" height="350">'.
               '<param name="movie" value="http://www.youtube.com/v/'.$matches[1].'" />'.
               '<param name="wmode" value="transparent" />'.
               '<embed src="http://www.youtube.com/v/'.$matches[1].'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350" />'. 

It works perfectly; but now i one website with the link have "," (like http://www.something.com/watch/yod,cn,hello-world-.html )

 

and their embedded code like this:

 

<object width="448" height="372"><param name="movie" value="http://www.something.com/w/yod,cn,0"/><param name="allowFullScreen" value="true"/><embed src="http://www.something.com/w/yod,cn,0" type="application/x-shockwave-flash" allowFullScreen="true" width="448" height="372"></embed></object> 

 

But i tried the same code with youtube up there, ti doesnt work, it said their some invalid characters; and i know that is because of "," character in the link and may be because of the link to the file and the link in embeded so different too ...

 

So how i get rid of that thing then i can embedded them like youtube?

 

Please help,

 

Thank you for your time

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.