Jump to content

Checking if a port is being used with fsockopen?


gergy008

Recommended Posts

Okay, I'm using fsockopen to see if a port is being used, But all it does it crashes the page if it isn't. If it is one it works but if it is off the pages just doesn't load at all.

 

Code:

<?php
$fp=fsockopen("localhost", 43594, $errno, $errstr, 30);
if($fp){
echo('The server is <font color="#0066FF"><b>Online!</b></font>');
} else {
echo('The server is <font color="#FF0000"><b>Offline!</b></font>');
}
?>

 

Can one of you amazing helpful souls help me out? Thanks in advance! :D

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.