Serverlist script

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
User avatar
Capm
DBB DemiGod
DBB DemiGod
Posts: 2267
Joined: Thu Nov 05, 1998 12:01 pm
Location: Topeka, KS
Contact:

Serverlist script

Post by Capm »

I need a specific serverlist script in php.

I need it to update a list of live D3 servers, and send that information into a text file in this format:

servername,ip,port,mode,#ofplayersingame,max#ofplayersingame,mapname

servername,ip,port,mode,#ofplayersingame,max#ofplayersingame,mapname

servername,ip,port,mode,#ofplayersingame,max#ofplayersingame,mapname

servername,ip,port,mode,#ofplayersingame,max#ofplayersingame,mapname

(each line should appear something like this:
2v2 Descent.cx,64.238.111.11,2100,Team Anarchy,0,4,indika.mn3
...)

The path for the output file would be
/files/webtext/serverlist.inc.txt

Its for use in our new website, which is nearing completion. Can anyone help with that?
User avatar
Capm
DBB DemiGod
DBB DemiGod
Posts: 2267
Joined: Thu Nov 05, 1998 12:01 pm
Location: Topeka, KS
Contact:

Post by Capm »

Anyone?
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

I did something similar a while ago, but im not sure if I have the code still.

in short, you need to understand the query protocol for D3(should be well documented, so you don't have to sit with a packet sniffer), and have it update a DB/text file every 90 seconds or so.
User avatar
Capm
DBB DemiGod
DBB DemiGod
Posts: 2267
Joined: Thu Nov 05, 1998 12:01 pm
Location: Topeka, KS
Contact:

Post by Capm »

If it updated whenever the page was loaded, that would work good too.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

Capm wrote:If it updated whenever the page was loaded, that would work good too.
you run the risk of flooding the servers with query requests. updating at a given interval makes more sense, than updating whenever someone requests a page, especially if more than one person requests a page at the same time.
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

Yeah the only real way to do it would be to have a query script run as a cron job and update a file that the webserver could serve.
User avatar
Capm
DBB DemiGod
DBB DemiGod
Posts: 2267
Joined: Thu Nov 05, 1998 12:01 pm
Location: Topeka, KS
Contact:

Post by Capm »

Well, the file is in the members section of the site, I don't forsee it being used too awful much.
Certainly not enough to cause problems.
User avatar
Capm
DBB DemiGod
DBB DemiGod
Posts: 2267
Joined: Thu Nov 05, 1998 12:01 pm
Location: Topeka, KS
Contact:

Post by Capm »

Actually, an "update list" button would work, with a timestamp that could be pulled by the page and displayed. That way if the list is fresh, it wouldn't need to be updated again.
User avatar
Capm
DBB DemiGod
DBB DemiGod
Posts: 2267
Joined: Thu Nov 05, 1998 12:01 pm
Location: Topeka, KS
Contact:

Post by Capm »

And I could put that where only certain people could access it, so there wouldn't be any flooding of servers, only time the list is used is for updating match server information when inputing a match into the database.
Post Reply