I got 10 urls in a file.
I want to show each url for 10 minutes and when done start over again.
<?php
$version = "v1.01";
$linksfile = "urlrotator.txt";
$urls = file("$linksfile");
$url = rand(0, sizeof($urls) - 1);
$goto = "$urls[$url]";
header("Location: $goto");
This just rotate random.
Need to be based on time
The urlrotator.txt
content look like following
nr1.html
nr2.html
nr3.html
nr4.html
nr5.html
nr6.html
nr7.html
nr8.html
nr9.html
nr10.html
2
Answers
Thanks...
So if I got 100 urls in the file do I need to change anyting in the script
You can use the
time
function to find the current second, and from that the current 10-minute chunk. Then use a modulo to find the remainder according to the number of URLs you have.