Beginners PHP 1:PHP GET

15 posts Page 2 of 2
Contributors
User avatar
Livengood
Serious Programmer
Serious Programmer
Posts: 444
Joined: Tue Feb 16, 2010 6:24 am

Re: Beginners PHP 1:PHP GET
Livengood
Alex wrote:
Livengood wrote:
now lets say you have a video player, but you want to use this to videos.? how would you do this, i know some php, but i am lost on trying to do this...
Well, you could get the video id and have in your root web directory a folder named "videos" so when a user uploads a video, it uploads it to that folder by the name of "1.avi","2.avi" and so on. Now, to use $_GET[] for that, it'd be something along the lines of...
Code: Select all
<?php
//playvideo.php (Or whatever you want to call it)
$videoid = $_GET['id'];
?>
<html>
<head>
<TITLE> Show Video</TITLE>
</head>
<body>
<embed src="<?php echo 'http://www.yourwebsite.com/videos/'.$videoid.'.avi'; ?>" autostart="false" />
</body>
</html>
Basically, we get the id of the video from the URL (http://www.yourwebsite.com/playvideo.php?id=1) and it would embed the video "http://www.yourwebsite.com/videos/1.avi" and tell it not to start on page load.
Thanks :), i understand that part lol
Know lets put this to perspective on Flv, and swf video player, how about that one? lol cause thats what i am working with
Image
User avatar
Alex
Member
Member
Posts: 40
Joined: Mon Feb 01, 2010 8:17 pm

Re: Beginners PHP 1:PHP GET
Alex
Livengood wrote:
Alex wrote:
Livengood wrote:
now lets say you have a video player, but you want to use this to videos.? how would you do this, i know some php, but i am lost on trying to do this...
Well, you could get the video id and have in your root web directory a folder named "videos" so when a user uploads a video, it uploads it to that folder by the name of "1.avi","2.avi" and so on. Now, to use $_GET[] for that, it'd be something along the lines of...
Code: Select all
<?php
//playvideo.php (Or whatever you want to call it)
$videoid = $_GET['id'];
?>
<html>
<head>
<TITLE> Show Video</TITLE>
</head>
<body>
<embed src="<?php echo 'http://www.yourwebsite.com/videos/'.$videoid.'.avi'; ?>" autostart="false" />
</body>
</html>
Basically, we get the id of the video from the URL (http://www.yourwebsite.com/playvideo.php?id=1) and it would embed the video "http://www.yourwebsite.com/videos/1.avi" and tell it not to start on page load.
Thanks :), i understand that part lol
Know lets put this to perspective on Flv, and swf video player, how about that one? lol cause thats what i am working with
You would just change the <embed src= part to the HTML code for embedding those types of files.
<?php

$wants_to_make_guide_today = true;
if($wants_to_make_guide_today == true){
make_guide();
}else{
sleep();
}
?>
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1891
Joined: Wed Dec 16, 2009 9:56 pm

Re: Beginners PHP 1:PHP GET
zachman61
hi it works perfectly but the video player is waaaaay to small
any ideas?
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
User avatar
Alex
Member
Member
Posts: 40
Joined: Mon Feb 01, 2010 8:17 pm

Re: Beginners PHP 1:PHP GET
Alex
zachman61 wrote:
hi it works perfectly but the video player is waaaaay to small
any ideas?
Use width and height parameters.
640x385 is youtube width/height if that helps.
Code: Select all
<embed src="<?php echo 'videos/'.$videoid.'.wmv'; ?>" autostart="false" width="640" height="385" />
<?php

$wants_to_make_guide_today = true;
if($wants_to_make_guide_today == true){
make_guide();
}else{
sleep();
}
?>
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1891
Joined: Wed Dec 16, 2009 9:56 pm

Re: Beginners PHP 1:PHP GET
zachman61
Your a Genius im nominating u for Moty
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
15 posts Page 2 of 2
Return to “Tutorials”