kona77 Posted November 21, 2011 Share Posted November 21, 2011 Hello Ladies and Gentleman, I am working on a project from an idea that I have and I am in WAY over my head when it comes to any type of code, etc. If there is a step by step then I can do it, but for this type of project I searched the forums and I definitely need a second opinion. Here is what I need, when someone clicks on a link in my app they will be taken to a url with a video. What is need is something that will grab a random video from a folder on my server with 20 videos. I don't want the same video to play every time someone goes to the url. I know that they will eventually get the same video if they return enough. I have my sites hosted at hostrocket if that helps any. Thank you in advance for any help or suggestions. Newbie PS This is how much I need help, the verification was 'In TCP/IP, the IP is short for Internet". I had to actually look that up. ROFL. Thanks All Quote Link to comment https://forums.phpfreaks.com/topic/251519-select-a-video-file-randomly-from-a-url/ Share on other sites More sharing options...
Adam Posted November 22, 2011 Share Posted November 22, 2011 You just need to read the contents of the directory containing the videos into an array (glob will make that easy), and use array_rand to randomly select one item from the array. You may want to later cache such a listing if this will be used heavily, but for now just concentrate on reading the contents using glob. PS This is how much I need help, the verification was 'In TCP/IP, the IP is short for Internet". I had to actually look that up. ROFL. Thanks All TCP/IP actually stands for "Transmission Control Protocol / Internet Protocol" Quote Link to comment https://forums.phpfreaks.com/topic/251519-select-a-video-file-randomly-from-a-url/#findComment-1290373 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.