Source Code:
(back to article)
<?php $port_number = 80; $protocol_name = "tcp"; $service_name = getservbyport($port_number, $protocol_name); if ($service_name === false) { echo "Failed to retrieve service name for port number $port_number and protocol name $protocol_name"; } else { echo "The service name for port number $port_number and protocol name $protocol_name is $service_name"; }
Result:
Report an issue