Hi, I am working on a site that wants to provide facility to check whether http port and ftp port of given ip address is working or not. I will provide an ip address i need to check status of all ports
One way you could test this would be:
[PHP]
$host="0.0.0.0";
$ports = array(21=>'ftp',80=>'http');
$timeout = 5.0;
foreach($ports as $port=>$description) {
$socket = @fsockopen($host, $port, $errno, $errstr, $timeout);
if ($errno) {
echo "ports not open<br>";
} else {
echo "port is open<br>";
}
@fclose($socket);
}[/PHP]
I just tested this on my server and it was detecting if the ports were open or closed properly. Let me know if you have any issues, but I think this may get you where you need to go.
Greg