PDA

View Full Version : Here's how to pull stats from your PF server



Vengeanze
11-10-2004, 05:32 AM
S!

This small info is for displaying stats from a FB server on a website using PHP.

I've been searching the web for this info but seems like they who knows don't wanna share.
Finally got it to work so thought I'd share.

First you'll need to have PHP installed on your webserver. If you're leasing then check with your webhotel.

Here's the script:
<pre class="ip-ubbcode-code-pre"><?php
$ip = "123.123.123.123";
$port = "21000";
$timeout = "30";
$fp = fsockopen("udp://" . $ip, $port, $errno, $errstr, $timeout);
fwrite($fp, '\status\\');
$str = fread($fp, 8192);
$data = explode("\\", $str);
for ($i=1; $i < count ($data); $i++) {
echo $i.'. '.$data[$i].'<br>';
}
?></pre>

What this does is opening a connection to the gameport.
Then u send a query to that port and put the data returned in a array.
Finally I just print out all the stats.
Note: This works not only on dedicated servers but also games hosted via the MP-function in the game.
Here's the same script in action:
Greatergreen FB Server (http://www.la-famiglia.se/test/gg.php)

Also, I've made a script that will post on your website when one of your member hosts a RW channel and allowing em to join by a simple link.
Also got a script running that checks the status of our Ventrilo server.
All done with PHP and MySql.


If you have any questions regarding the above then just reply or mail me at larm@home.se.

Hope this can be usefull for some of u squad webmasters.

Vengeanze
11-10-2004, 05:32 AM
S!

This small info is for displaying stats from a FB server on a website using PHP.

I've been searching the web for this info but seems like they who knows don't wanna share.
Finally got it to work so thought I'd share.

First you'll need to have PHP installed on your webserver. If you're leasing then check with your webhotel.

Here's the script:
<pre class="ip-ubbcode-code-pre">&lt;?php
$ip = "123.123.123.123";
$port = "21000";
$timeout = "30";
$fp = fsockopen("udp://" . $ip, $port, $errno, $errstr, $timeout);
fwrite($fp, '\status\\');
$str = fread($fp, 8192);
$data = explode("\\", $str);
for ($i=1; $i &lt; count ($data); $i++) {
echo $i.'. '.$data[$i].'&lt;br&gt;';
}
?&gt;</pre>

What this does is opening a connection to the gameport.
Then u send a query to that port and put the data returned in a array.
Finally I just print out all the stats.
Note: This works not only on dedicated servers but also games hosted via the MP-function in the game.
Here's the same script in action:
Greatergreen FB Server (http://www.la-famiglia.se/test/gg.php)

Also, I've made a script that will post on your website when one of your member hosts a RW channel and allowing em to join by a simple link.
Also got a script running that checks the status of our Ventrilo server.
All done with PHP and MySql.


If you have any questions regarding the above then just reply or mail me at larm@home.se.

Hope this can be usefull for some of u squad webmasters.