PHP Network functions

Quick reference to the Network functions of PHP.

Network functions
Function Returns Does what
checkdnsrr(host [, type]) Boolean Searches DNS of "host" for records of "type"
fsockopen(host [, port [, errno [, errstr [, timeout]]]]) Integer Opens a socket connection
gethostbyaddr(ip) String Returns hostname for "ip"
gethostbyname(host) String Returns one IP-address for "host"
gethostbynamel(host) Array Returns array of IP-addresses for "host"
getmxrr(host, mxhosts [, weight]) Boolean Returns MX records for "host"
getprotobyname(string) Integer Returns protocol number of "string"
getprotobynumber(number) String Returns protocol name for "number"
getservbyname(service, protocol) Integer Returns port number for "service" and "protocol"
getservbyport(port, protocol) String Returns service name for "port" and "protocol"
pfsockopen(host [, port [, errno [, errstr [, timeout]]]]) Integer Opens persistent socket connection
socket_set_option(socket, level, opt_name, opt_value) Boolean Sets "opt_name" = "opt_value" for socket
Function Returns Does what
ip2long(string) Integer Converts "string" (ip-address) to proper address
long2ip(string) Integer Converts "string" (proper address) to IP-address
System log functions
Function Returns Does what
closelog() Boolean Close connection to syslog
define_syslog_variables() Nothing Initializes all syslog variables
openlog(ident, option, facility) Boolean Opens connection to syslog
syslog(priority, string) Boolean Writes "string" to syslog

See also: PHP Internet functions.