PHP Script - Open port check

Got this from Vinu’s blog. This simple script will attempt to connect to the site:port using fsockopen to determine if a service is running on the port.

< ?php

$site = "vinuthomas.com";
$port = 80;

$fp = fsockopen($site,$port,$errno,$errstr,10);
if(!$fp)
{
echo "Cannot connect to server";
}

else{
echo "Connect was successful - no errors on Port ".$port." at ".$site;
fclose($fp);
}

?>



Search the Web with Google

1 Response to “PHP Script - Open port check”


  1. 1 TyroneGlover

    thanks,

    1

Leave a Reply