ChopSuey 0 Report post Posted July 25, 2006 I have a server for a game on my computer, and want to put a server status code on my website. I was wondering if something like this would work: <?$ip = "IP"; // IP Here$port = PORT; // Port Hereif(fsockopen($ip, $port, $errno, $errstr, '10'))echo "The game server is <font color='green'>Online</font>!";elseecho "The game server is <font color='red'>Offline</font>!";?> Share this post Link to post Share on other sites
electron 0 Report post Posted July 26, 2006 But which post will you try to connect to.Also will the server allow you to do so. Share this post Link to post Share on other sites
ChopSuey 0 Report post Posted July 26, 2006 My game server will allow, but will the host? XDPort: 50000 Share this post Link to post Share on other sites
uiop 0 Report post Posted July 26, 2006 I belive that would work, why don't you try ? Share this post Link to post Share on other sites
ChopSuey 0 Report post Posted July 26, 2006 I tried it, and it doesnt seem to connect. I get a php warningWarning: fsockopen(): unable to connect to ar.servegame.com:50000 in /home/chopsuey/public_html/test.php on line 14 Share this post Link to post Share on other sites
farsiscript 0 Report post Posted July 28, 2006 dear ChopSuey i think you must select port at localhost ( your hosting) for any connection you need 2 open port and 2 ip , at this code you select remote port (your pc) but you dont select local port (default = 80 ) you need to active localport !thanks <?$ip = "IP"; // IP Here$port = PORT; // Port Hereif(fsockopen($ip, $port, $errno, $errstr, '10'))echo "The game server is <font color='green'>Online</font>!";elseecho "The game server is <font color='red'>Offline</font>!";?> Share this post Link to post Share on other sites
beeseven 0 Report post Posted July 28, 2006 If your server has a router you may need to forward port 50000. Share this post Link to post Share on other sites