Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/251519-select-a-video-file-randomly-from-a-url/
Share on other sites

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" ;)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.