gethostbyaddr
Description
The gethostbyaddr of Network for PHP gets the Internet host name corresponding to a given IP address.
Syntax
gethostbyaddr(
string $ip
): string|falseParameters
ip
The host IP address.
Return
Returns the host name on success, the unmodified ip on failure, or false on malformed input.
Examples
1 · ip
<? $ip = "185.85.0.29"; $return = gethostbyaddr($ip); echo $return;
ip-185-85-0-29.ax5z.com
2 · ip · REMOTE_ADDR
<? $ip = $_SERVER["REMOTE_ADDR"]; $return = gethostbyaddr($ip); echo $return;
ip-185-85-0-29.ax5z.com
3 · ip · unmodified
<? $ip = "0.0.0.0"; $return = gethostbyaddr($ip); echo $return;
0.0.0.0
4 · ip · malformed
<? $ip = "0.0.0.0.0"; $return = gethostbyaddr($ip); var_export($return);
false
Links
Related
Network
- checkdnsrr
- closelog
- dns_check_record
- dns_get_mx
- dns_get_record
- fsockopen
- gethostbyname
- gethostbynamel
- gethostname
- getmxrr
- getprotobyname
- getprotobynumber
- getservbyname
- getservbyport
- header
- header_register_callback
- header_remove
- headers_list
- headers_sent
- http_clear_last_response_headers
- http_get_last_response_headers
- http_response_code
- inet_ntop
- inet_pton
- ip2long
- long2ip
- openlog
- pfsockopen
- setcookie
- setrawcookie
- socket_get_status
- socket_set_blocking
- socket_set_timeout
- syslog