Check if a port is open with PHP
The following function returns true / false if a port is open with PHP.
function stest($ip, $portt) {
$fp = @fsockopen($ip, $portt, $errno, $errstr, 0.1);
if (!$fp) {
return false;
} else {
fclose($fp);
return true;
}
}
Written by Michael Gane
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#