SkyRanger Posted June 2, 2007 Share Posted June 2, 2007 I am trying to create a script to check a server status based on IP and Port number. I know the server is up because I tested it first to make sure, but when I check it in my script it says it is offline. Not sure what the problem is, or if I am even doing this right <?php $gameserver = '64.182.161.102:27033'; if (preg_match ("/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i", $gameserver)) { print "$gameserver is currently online."; } else { print "$gameserver is currently offline!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/53997-solved-server-status/ Share on other sites More sharing options...
taith Posted June 2, 2007 Share Posted June 2, 2007 um... pregmatch only checks if the string is typed in properly... it wouldnt check if the server is up or down... Quote Link to comment https://forums.phpfreaks.com/topic/53997-solved-server-status/#findComment-266921 Share on other sites More sharing options...
SkyRanger Posted June 2, 2007 Author Share Posted June 2, 2007 Well that could explain why it shows the domainname as offline but the IP off...lol, ok, thanks taith, back to square one. Quote Link to comment https://forums.phpfreaks.com/topic/53997-solved-server-status/#findComment-266924 Share on other sites More sharing options...
chigley Posted June 2, 2007 Share Posted June 2, 2007 You can use fopen() or file_get_contents() instead.. Quote Link to comment https://forums.phpfreaks.com/topic/53997-solved-server-status/#findComment-266977 Share on other sites More sharing options...
cmgmyr Posted June 2, 2007 Share Posted June 2, 2007 Check this out: http://www.hotscripts.com/Detailed/40007.html Quote Link to comment https://forums.phpfreaks.com/topic/53997-solved-server-status/#findComment-267118 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.