24.01.2013, 10:25
(
Последний раз редактировалось dmbekker; 24.01.2013 в 10:55.
)
Hi there,
Because of boredness I created a simple XML api to retrieve some info about your server (rules, info and player list). The api is located at http://sampapi.d4v1d.nl/ and takes 2 arguments: Format (currently only XML is supported, soon json will be) and IP:PORT, so, for example: http://sampapi.d4v1d.nl/xml/85.17.169.205:7787 would give the following output:
If something goes wrong it always tries to give a nice and fancy error message. Current errors (that are catched and give a nice error message) are:
Because of boredness I created a simple XML api to retrieve some info about your server (rules, info and player list). The api is located at http://sampapi.d4v1d.nl/ and takes 2 arguments: Format (currently only XML is supported, soon json will be) and IP:PORT, so, for example: http://sampapi.d4v1d.nl/xml/85.17.169.205:7787 would give the following output:
Код:
<server> <errors/> <info> <value name="password"> <![CDATA[ 0 ]]> </value> <value name="players"> <![CDATA[ 13 ]]> </value> <value name="maxplayers"> <![CDATA[ 30 ]]> </value> <value name="hostname"> <![CDATA[ [0.3e](`._.[Andromada Sumo]._.) ]]> </value> <value name="gamemode"> <![CDATA[ [A]Sumo V2.5.4 ]]> </value> <value name="mapname"> <![CDATA[ Find it ]]> </value> </info> <rules> <value name="gravity"> <![CDATA[ 0.008 ]]> </value> <value name="mapname"> <![CDATA[ Find it ]]> </value> <value name="version"> <![CDATA[ 0.3e-R2 ]]> </value> <value name="weather"> <![CDATA[ 10 ]]> </value> <value name="weburl"> <![CDATA[ andromada.net ]]> </value> <value name="worldtime"> <![CDATA[ 13:00 ]]> </value> </rules> <players> <value playerid="0" score="132" ping="26">d4v1d</value> <!-- More players. --> </players> </server>
- Fatal The given IP adress and/or port is invalid Happens if the ip isn't valid according to php's filter_var function or the port isn't numeric.
- Fatal No IP and/or port given Happens if IP or Port is not given. (This shouldn't be possible but it's scripted in just in case.)
- Fatal Server isn\'t online Happens if the api cannot connect to the server.