PHP Classes
elePHPant
Icontem

Battlefield 2 Server Query: Query information from a Battlefield 2 game server

Recommend this page to a friend!
  Info   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2006-02-06 (10 years ago) RSS 2.0 feedStarStarStar 57%Total: 1,610 All time: 2,367 This week: 1,090Up
Version License Categories
battlefield-2-server 1.0Free for non-comm...Statistics, Games
Description Author

This is a simple class that can query Battlefield 2 game servers to retrieve the available public information.

The class returns an array that contains the information provided by the server: players, maps played, game types, scores, etc..

Picture of Bogdan Zarchievici
Name: Bogdan Zarchievici <contact>
Classes: 6 packages by
Country: Romania Romania

Details
BATTLEFIELD 2 - GAME SERVER QUERY CLASS

Written by: Bogdan Zarchievici <opensource@creative-media.ro>
Version: 5.0.1.a
Revision: Monday, February 06, 2006 at 5:10:15 PM

Comments: works with any PHP version greater than 4.1.0.

Special thanks to: Michael Damato, Brian Manning and all of you who have been actively interested in the development of this class.

For more details on the Gamespy Query Format please visit:
http://forums.gametrack.org/viewtopic.php?t=311
http://dev.kquery.com/index.php?article=47

------------------------------------------------------------------------

FEATURES:

* Parses all data provided by the Battlefield 2 servers into one array. It's easy to use in any other PHP project.
* Supports 1-128 players servers.
* Shows the number of players that are currently connecting to the Battlefield 2 server.
* Shows the number of players that will be disconnected from the server due to timeout.
* Has three different templates that show you some advanced features of this class.

------------------------------------------------------------------------

USAGE:

Call the PHP class:

	$battlefield_2=&new battlefield_2(IP,PORT);

Getting the status of the Battlefield 2 server:

	$status=get_object_vars($battlefield_2);
	print_r($status['results']);

You must complete the 1st and 2nd parameter of the status function with the IP and PORT of the  Battlefield 2 server you want to query.

There is currently only 1 variable that you can easily change:
TIMEOUT = I recommend leaving it to 10 (ten) seconds. However you can increase or decrease it as you like.

------------------------------------------------------------------------

CONTACT:

Please use the following e-mail address in case you find any bugs. Also, feel free to contact me if you need any help setting up this class.
If you use this class in your PHP project or on your website, please drop me a message and tell me the link to your website so I can put it on my website.

opensource [at] creative-media.ro
  Files folder image Files  
File Role Description
Files folder imagetemplates (3 files)
Plain text file battlefield-2-class.php Class Class
Accessible without login Plain text file battlefield-2-layout.php Aux. Layout for the example
Accessible without login Plain text file index.php Example Example
Accessible without login Plain text file readme.txt Doc. Readme

  Files folder image Files  /  templates  
File Role Description
  Accessible without login Plain text file classic.php Aux. Classic Template
  Accessible without login Plain text file in-game.php Aux. In-Game Template
  Accessible without login Plain text file raw.php Aux. Raw Template

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,610
This week:0
All time:2,367
This week:1,090Up
 User Ratings  
 
 All time
Utility:75%StarStarStarStar
Consistency:68%StarStarStarStar
Documentation:68%StarStarStarStar
Examples:62%StarStarStarStar
Tests:-
Videos:-
Overall:57%StarStarStar
Rank:1406