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);}
?>Share This