assigned with the weight for each host. The return value signals whether the operation
was successful.
Chapter 18 contains an example of using getmxrr to verify an email address.
//get mail-exchanger records for clearink.com
getmxrr("clearink.com", $mxrecord, $weight);
//display results
for($index=0; $index count($mxrecord); $index++)
{
print($mxrecord[$index]);
print(" - ");
print($weight[$index]);
print("BR>\n");
}
?>
integer getprotobyname(string name)
The getprotobyname function returns the number associated with a protocol.
string getprotobynumber(integer protocol)
The getprotobynumber function returns the name of a protocol given its number.
integer getservbyname(string service, string protocol)
The getservbyname function returns the port used by a service. The protocol argument
must be tcp or udp.
//check which port ftp uses
$port = getservbyname("ftp", "tcp");
print("port $port
\n");
?>
string getservbyport(integer service, string protocol)
The getservbyport function returns the name of the service that uses a specified port.
The protocol argument must be tcp or udp.
<?
//check which service uses port 25