How to use getservbyport() function to get Internet service corresponds to port and protocol in PHP

1 Answer

0 votes
$port = 23;
$protocol = 'tcp';
   
$service = getservbyport($port, $protocol) or die ("No service");
   
echo "Port: $port <br /> Service: $service <br /> Protocol: $protocol";
   
/*
run: 

Port: 23
Service: telnet
Protocol: tcp 

*/

 



answered May 8, 2016 by avibootz
...