PHP.nl

getservbyname

getservbyname

Get port number associated with an Internet service and protocol

 **getservbyname** string $service string $protocol
returns the Internet port

which corresponds to for the specified as per . getservbyname``service``protocol

serviceThe Internet service name, as a string.

protocol is either or (in lowercase). protocol``"tcp"``"udp"

Returns the port number, or false if or is not found. service``protocol

Voorbeeld: example

<?php
$services = array('http', 'ftp', 'ssh', 'telnet', 'imap',
'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www');

foreach ($services as $service) {
    $port = getservbyname($service, 'tcp');
    echo $service . ": " . $port . "<br />\n";
}
?>

getservbyporturl.network.port-numbers