Change include_once file after specific time

Hello,

I’m not sure I’m posting this question in the right thread, because i dont know if it is php or javascript related or maybe both :slight_smile:
I would like to know if it is possible , and if it is how to manage this.

I try to explain what i would like to create.

I have a livestream player called Clappr player , it runs with authentication and it calls an file from root with in this file the server ip.
After specific time i would like to change the server ip to other server ip’s by calling another file, where other server ip’s are stored.

I am not sure if this can be done with only php or and/with javascript.

Here is my code example;

<?php include_once($_SERVER["DOCUMENT_ROOT"] . "/nimble.php"); include_once($_SERVER["DOCUMENT_ROOT"] . "/name.php"); $channel = "1"; $url = $servers[array_rand($servers)]; $name = $servers1[array_rand($servers1)]; $hls = "http://$url/live/$name$channel/playlist.m3u8"; ?>

The above code asking from the nimble.php the server ip, i wish to get this file changed after several minutes to another file called cloud.php which contains several ip’s

The nimble.php contains this;

<?php $servers = array("my.stream.server.ip"); ?>

The cloud.php contains this;

<?php $servers = array("ser.ver.ip.1","ser.ver.ip.2","ser.ver.ip.3","ser.ver.ip.4","ser.ver.ip.5","ser.ver.ip.6","ser.ver.ip.7","ser.ver.ip.8","ser.ver.ip.9","ser.ver.ip.10"); ?>

The player itself running this code

var source = ‘<?php echo $hls;?>?wmsAuthSign=<?php echo $base64urlsignature;?>’;

So, i dont know if this can be done with php to change the nimble.php after 5 minutes to cloud.php.
Could it also be possible to add redirect script (javascript) in the nimble.php file so it re-loads/redirects after 5 minutes to the cloud.php?

I really hope this can be done and would like to get some help, because for now i am stuck and can’t find my answer on the net.

With Kind regards!!

What effect do you want this to have?

If you have a user viewing your website and you want them to see something different every five minutes, then it’s a front end problem you’ll need to handle with javascript.

If you want your website to look different to new users every five minutes, then it’s a back end problem you’ll need to handle with PHP.

Hello,

No i just try to change just 1 time after 5/7 minutes.

Sponsor our Newsletter | Privacy Policy | Terms of Service