I have a PHP script that connects to a shoutcast radio server however we have 3 servers which we need to random connect to, everything is set in a config file i.e
// ip or url of shoutcast server
$scip = "123.123.123.123";
// port of shoutcast server
$scport = "8026";
however i need to be able to set 3 ips and 3 related ports like example:
$serv_1 = '123.123.123.123';
$port_1 = '8026';
$serv_2 = '456.456.456.456';
$port_2 = '8702';
$serv_3 = '789.789.789.789';
$port_3 = '8026';
What i need to do is when page is loaded to select and ip and its related port at random and then set to the main scip and scport variables so that the listener will be on a randon shoutcast server and everything is not just set to 1 server
Im looking at doing this in PHP?
How about something like this…
Put the server and port in a multidimensional array, defining each with a unique number (1-3). Pick a number at random between 1 and 3 (
rand(1,3)) and then use that number to grab random server & port.