PHP/Date/getservbyname
getservbyname.php
<?php
echo "HTTP"s default port number is: ".getservbyname("http", "tcp");
?>
Using getservbyname()
<?php
$service = "ftp";
$port = getservbyname($service, "tcp");
if($port === false) {
die("Lookup of service "$service" failed.\n");
} else {
echo "Service "$service" runs on port $port\n";
}
?>