Jump to content

Recommended Posts

I've been looking for a simple script that would connect to a game server to see if it is still online. I've found many, but not one of them work. They will permanently send back the text "Online", or "Offline". This is the simplest code I have found:

 

<?php
$ip = "66.79.190.40"; 
$port = "27960"; 
if (! $sock = @fsockopen($ip, $port, $num, $error, 5)) 
echo '<B><FONT COLOR=red>Offline</b></FONT>'; 
else{ 
echo '<B><FONT COLOR=lime>Online</b></FONT>'; 
fclose($sock); 
} 
?>

 

I'm also looking into getting it to pull the map name and player-list, but I should be able to figure that out on my own once I get this working. If it helps, this script is supposed to connect to the original Quake games(One, two, and three).

What is the error?

 

<?php
$ip = "66.79.190.40"; 
$port = "27960"; 
if (! $sock = @fsockopen($ip, $port, $num, $error, 5)) 
echo '<B><FONT COLOR=red>Offline</b></FONT>'; 
echo '<br />'.$num.'<br />'.$error;
else{ 
echo '<B><FONT COLOR=lime>Online</b></FONT>'; 
fclose($sock); 
} 
?>

 

-cb-

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.