...

View Full Version : Possible to use PHP to embed Youtube Videos



cozzy1984
03-12-2008, 06:06 PM
Was just wondering if it was possible to do this.

My think was to have a input box that the user could paste the youtube link into. This would then save the path to the file in the database and then when viewing the selected item it would use the url to get the video.

Would i be along the right lines or is this not even possible?

Andrew Johnson
03-12-2008, 06:12 PM
Try:



<?php

if ($_SERVER["REQUEST_METHOD"] == "POST") {

?>
<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/<?php echo $_POST["YouTubeID"]; ?>"> </param> <embed src="http://www.youtube.com/v/<?php echo $_POST["YouTubeID"]; ?>" type="application/x-shockwave-flash" width="425" height="350"> </embed> </object>
<?php

} else {

?>
<form method="post" action="">
YouTube ID: <input type="text" name="YouTubeID" />
</form>
<?php

}

?>

cozzy1984
03-12-2008, 09:46 PM
Cheers mate, thought it was simple, and it was.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum