PHP/Date/getservbyport
getservbyport.php
<?php
echo "Port 80"s default service is: ".getservbyport(80, "tcp");
?>
Using getservbyport()
<?php
$port = 80;
$service = getservbyport($port, "tcp");
if($service === false) {
die("Could not find a service running on $port\n");
} else {
echo "The "$service" service runs on port $port\n";
}
?>