Jump to content

get status of game server


gnize

Recommended Posts

Hello. Just wondering if someone could help me with this script.

 

What it does it get the status of a game server. Status shows players names score etc.

 

I'm running php version 5 (PHP version 5.2.6) and Apache version 1.3.41 (Unix)

 

<?PHP

 

    $open = fsockopen("udp://xz.sytes.net", 28960);

   

    socket_set_timeout($open, 1);

   

    fwrite($open, "\xFF\xFF\xFF\xFFgetstatus");

   

    $result = fread($open, 8192);

   

    echo $result;

   

    exit();

 

?>

 

Does my web host need to have that port open to recive the info?

 

When I run the php file from a web browser it shows a blank page.

 

Any help would be awesome. Please and thanks.

 

Gnize.d

 

Link to comment
https://forums.phpfreaks.com/topic/118320-get-status-of-game-server/
Share on other sites

Your code looks a little haphazard. I don't exactly know which protocol or port for that matter you are using but try something more like this:

 

<?php

$open = @fsockopen( "xs.sytes.net", 28960, $no, $str, 5 ) or die( 'Connection Failed' );
fwrite( $open, "\xFF\xFF\xFF\xFFgetstatus\r\n" );
print fread( $open, 8192 );

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.