Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8852781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:29:12+00:00 2026-06-14T13:29:12+00:00

I have a PHP script that connects to a shoutcast radio server however we

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:29:13+00:00Added an answer on June 14, 2026 at 1:29 pm

    How about something like this…

    $serv[1]['serv'] = '123.123.123.123';
    $serv[1]['port'] = '8026';
    $serv[2]['serv'] = '456.456.456.456';
    $serv[2]['port'] = '8702';
    $serv[3]['serv'] = '789.789.789.789';
    $serv[3]['port'] = '8026';
    
    $randNo = rand(1,3);
    $randServ = $serv[$randNo]['serv'];
    $randPort = $serv[$randNo]['port'];
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script that connects 10 different servers to get data. I
I have a PHP script that will throw exceptions (e.g. cannot connect to server).
I have a simple php script on a server that's using fsockopen to connect
I have a PHP script that connects to an API and grabs around 200
I have a php script that connects to a database and does inserts/updates, obviously,
I have a PHP script that I wrote, and one of the pages connects
I have a PHP mail script that successfully sends emails to everything BUT GMail
I have an ajax request that requests a php script that connects to my
I have a multi-threaded script which occasionally freezes when it connects to a server
I have a PHP script that connects to an api and posts information to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.