how to replace youtube link with youtube embeded code ?

Discussion in 'PHP' started by ramysarwat, Aug 17, 2010.

  1. #1
    how to replace youtube link with youtube embedded code ?
     
    ramysarwat, Aug 17, 2010 IP
  2. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #2
    It'll be something like this yo:
    
    <form action="" method="POST">
    Youtube link plz: <input type="text" name="poop" />
    </form>
    <?php
    if(isset($_POST['poop'])) {
       $youtube = $_POST['poop'];
       $lol = explode("watch?v=", $youtube);
       hallooo($lol[1]);
    }
    
    function hallooo($wuutt) {
       echo "<textarea cols=\"150\" row=\"100\">
       <object type=\"application/x-shockwave-flash\" style=\"width:425px; height:344px;\" data=\"http://www.youtube.com/v/$wuutt\">
       <param name=\"movie\" value=\"http://www.youtube.com/v/$wuutt\" />
       </object></textarea>";
    }
    ?>
    
    PHP:
     
    Rainulf, Aug 17, 2010 IP