PHP Function Reference

PHP - Network



The PHP provides contains various network functions which let you manipulate information sent to the browser by the Web server, before any other output has been sent.

Installation

There is no installation needed to use these functions. These functions are part of the PHP core.

PHP Network Functions

FunctionsDescription
checkdnsrr() Check DNS records corresponding to a given Internet host name or IP address.
dns_check_record() Check DNS records corresponding to a given Internet host name or IP address. Alias of checkdnsrr() function.
dns_get_mx() Get MX records corresponding to a given Internet host name. Alias of getmxrr() function.
fsockopen() Open Internet or Unix domain socket connection.
gethostname() Gets the host name.
gethostbyaddr() Get the Internet host name corresponding to a given IP address.
gethostbyname() Get the IPv4 address corresponding to a given Internet host name.
gethostbynamel() Get a list of IPv4 addresses corresponding to a given Internet host name.
getmxrr() Get MX records corresponding to a given Internet host name.
getprotobyname() Get protocol number associated with protocol name.
getprotobynumber() Get protocol name associated with protocol number.
getservbyname() Get port number associated with an Internet service and protocol.
getservbyport() Get Internet service which corresponds to port and protocol.
ip2long() Converts a string containing an (IPv4) Internet Protocol dotted address into a long integer.
long2ip() Converts an long integer address into a string in (IPv4) Internet standard dotted format.

PHP Network Predefined Constants

The constants below are always available as part of the PHP core.

ConstantsTypeDescription

5