Iframe issue in PHP variable

thildouille -  
 thildouille -
Hello,
Hello,

I have a little issue. I'm working on a site that will offer videos from both YouTube and Dailymotion. The principle is not new; I receive the code via a form:

<iframe width="425" height="349" src="http://www.youtube.com/embed/TUfzu2p-2RE" frameborder="0" allowfullscreen></iframe>


which I store in a database to be displayed on the site later.

It turns out that I need to retrieve the ID of the videos sent.

Initially, I planned to use str_replace to remove spaces and strstr to select what interests me.

The problem is that when I want to remove spaces by calling:

$source = "$row_traitement['source']"; /*(where the YouTube iframe is stored)*/ $machaine = str_replace(CHR(32),"",$source); echo $machaine;


I get a nice Parse error: syntax error, unexpected T_STRING in

If I do:

$source = "$row_traitement['source']"; echo $source;


My YouTube video displays.

Thank you in advance

Configuration: Windows 7 / Safari 533.20.27

1 answer

  1. thildouille
     
    Knowing that if I do

    $source = '<iframe width="425" height="349" src="http://www.youtube.com/embed/EM4vblG6BVQ" frameborder="0" allowfullscreen></iframe>'; /*echo $source;*/ $machaine = str_replace(CHR(32),"",$source); echo $machaine;/*


    Nothing shows up.
    0