dzhax Posted January 19, 2009 Share Posted January 19, 2009 Ok so I am using fsockopen to determine if my server is online and display wether or not on a webpage.It works good when the server is online.when the server is not online, it displays my message that it is not online but it also show an ugly WARNING line that says the request timed out.Is there a way to not have that warning show up? <?phpShowServ("HOSTNAME", PORTNUMBER); function ShowServ($ip, $port) { $fp = fsockopen("$ip", $port, $errno, $errstr, 1); if (!$fp) {Echo"Server Is Offline";} if ($fp) {Echo "Server Is Online";}}?> Warning: fsockopen() [function.fsockopen]: unable to connect to *HOST AND PORT REMOVED FOR PRIVACY* (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\www\vhosts\localhost\server-status2.php on line 4Server Is Offline Link to comment Share on other sites More sharing options...
Synook Posted January 19, 2009 Share Posted January 19, 2009 You can suppress errors with the @ prefix, e.g. $fp = @fsockopen("$ip", $port, $errno, $errstr, 1); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.