Funkce PHP getservbyname().
Příklad
Příklad getservbyname():
<?php
$portnum = getservbyname("http", "tcp");
echo $portnum;
?>
Definice a použití
Funkce getservbyname() vrací číslo portu pro danou internetovou službu a protokol.
Syntax
getservbyname(service, protocol)
Hodnoty parametrů
Parameter | Description |
---|---|
service | Required. Specifies the Internet service name (like "http") |
protocol | Required. Specifies a protocol name (like "tcp" or "udp") |
Technické údaje
Návratová hodnota: | Číslo portu při úspěchu. NEPRAVDA při selhání |
---|---|
Verze PHP: | 4,0+ |
❮ Síťová reference PHP